diff options
author | Diva Canto | 2014-05-23 16:19:43 -0700 |
---|---|---|
committer | Diva Canto | 2014-05-23 16:19:43 -0700 |
commit | 20f20895cf1444071d5edc42e11a1fb94b1b1079 (patch) | |
tree | 0c7547590a89eec47886e0a8646f86ebbf449e63 /OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-20f20895cf1444071d5edc42e11a1fb94b1b1079.zip opensim-SC-20f20895cf1444071d5edc42e11a1fb94b1b1079.tar.gz opensim-SC-20f20895cf1444071d5edc42e11a1fb94b1b1079.tar.bz2 opensim-SC-20f20895cf1444071d5edc42e11a1fb94b1b1079.tar.xz |
Adds optional HTTP Basic Authentication to Robust service connectors.
Diffstat (limited to 'OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2ba8e04..0996acb 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AssetServicesConnector : IAssetService | 42 | public class AssetServicesConnector : BaseServiceConnector, IAssetService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors | |||
71 | } | 71 | } |
72 | 72 | ||
73 | public AssetServicesConnector(IConfigSource source) | 73 | public AssetServicesConnector(IConfigSource source) |
74 | : base(source, "AssetService") | ||
74 | { | 75 | { |
75 | Initialise(source); | 76 | Initialise(source); |
76 | } | 77 | } |
@@ -126,7 +127,7 @@ namespace OpenSim.Services.Connectors | |||
126 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( | 127 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( |
127 | // "GET", uri, 0, m_maxAssetRequestConcurrency); | 128 | // "GET", uri, 0, m_maxAssetRequestConcurrency); |
128 | 129 | ||
129 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0); | 130 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); |
130 | 131 | ||
131 | if (m_Cache != null) | 132 | if (m_Cache != null) |
132 | m_Cache.Cache(asset); | 133 | m_Cache.Cache(asset); |
@@ -156,7 +157,7 @@ namespace OpenSim.Services.Connectors | |||
156 | 157 | ||
157 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 158 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; |
158 | 159 | ||
159 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0); | 160 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
160 | return asset; | 161 | return asset; |
161 | } | 162 | } |
162 | 163 | ||
@@ -177,7 +178,7 @@ namespace OpenSim.Services.Connectors | |||
177 | 178 | ||
178 | rc.RequestMethod = "GET"; | 179 | rc.RequestMethod = "GET"; |
179 | 180 | ||
180 | Stream s = rc.Request(); | 181 | Stream s = rc.Request(m_Auth); |
181 | 182 | ||
182 | if (s == null) | 183 | if (s == null) |
183 | return null; | 184 | return null; |
@@ -238,7 +239,7 @@ namespace OpenSim.Services.Connectors | |||
238 | m_AssetHandlers.Remove(id); | 239 | m_AssetHandlers.Remove(id); |
239 | } | 240 | } |
240 | handlers.Invoke(a); | 241 | handlers.Invoke(a); |
241 | }, m_maxAssetRequestConcurrency); | 242 | }, m_maxAssetRequestConcurrency, m_Auth); |
242 | 243 | ||
243 | success = true; | 244 | success = true; |
244 | } | 245 | } |
@@ -268,7 +269,7 @@ namespace OpenSim.Services.Connectors | |||
268 | bool[] exist = null; | 269 | bool[] exist = null; |
269 | try | 270 | try |
270 | { | 271 | { |
271 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids); | 272 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth); |
272 | } | 273 | } |
273 | catch (Exception) | 274 | catch (Exception) |
274 | { | 275 | { |
@@ -297,7 +298,7 @@ namespace OpenSim.Services.Connectors | |||
297 | string newID; | 298 | string newID; |
298 | try | 299 | try |
299 | { | 300 | { |
300 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset); | 301 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); |
301 | } | 302 | } |
302 | catch (Exception e) | 303 | catch (Exception e) |
303 | { | 304 | { |
@@ -343,7 +344,7 @@ namespace OpenSim.Services.Connectors | |||
343 | 344 | ||
344 | string uri = m_ServerURI + "/assets/" + id; | 345 | string uri = m_ServerURI + "/assets/" + id; |
345 | 346 | ||
346 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset)) | 347 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
347 | { | 348 | { |
348 | if (m_Cache != null) | 349 | if (m_Cache != null) |
349 | m_Cache.Cache(asset); | 350 | m_Cache.Cache(asset); |
@@ -357,7 +358,7 @@ namespace OpenSim.Services.Connectors | |||
357 | { | 358 | { |
358 | string uri = m_ServerURI + "/assets/" + id; | 359 | string uri = m_ServerURI + "/assets/" + id; |
359 | 360 | ||
360 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0)) | 361 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
361 | { | 362 | { |
362 | if (m_Cache != null) | 363 | if (m_Cache != null) |
363 | m_Cache.Expire(id); | 364 | m_Cache.Expire(id); |