diff options
Diffstat (limited to 'OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs')
-rw-r--r-- | OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index a2f5d9c..05c64fa 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -74,16 +74,26 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
74 | 74 | ||
75 | try | 75 | try |
76 | { | 76 | { |
77 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | ||
78 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | ||
79 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | ||
80 | string xmlSource = String.Empty; | 77 | string xmlSource = String.Empty; |
81 | string tempStr = reader.ReadLine(); | 78 | |
82 | while (tempStr != null) | 79 | using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) |
83 | { | 80 | { |
84 | xmlSource = xmlSource + tempStr; | 81 | m_log.Debug("[WEBLOADER]: Downloading region information..."); |
85 | tempStr = reader.ReadLine(); | 82 | |
83 | using (Stream s = webResponse.GetResponseStream()) | ||
84 | { | ||
85 | using (StreamReader reader = new StreamReader(s)) | ||
86 | { | ||
87 | string tempStr = reader.ReadLine(); | ||
88 | while (tempStr != null) | ||
89 | { | ||
90 | xmlSource = xmlSource + tempStr; | ||
91 | tempStr = reader.ReadLine(); | ||
92 | } | ||
93 | } | ||
94 | } | ||
86 | } | 95 | } |
96 | |||
87 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 97 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + |
88 | xmlSource.Length); | 98 | xmlSource.Length); |
89 | XmlDocument xmlDoc = new XmlDocument(); | 99 | XmlDocument xmlDoc = new XmlDocument(); |
@@ -107,17 +117,24 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
107 | } | 117 | } |
108 | catch (WebException ex) | 118 | catch (WebException ex) |
109 | { | 119 | { |
110 | if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) | 120 | using (HttpWebResponse response = (HttpWebResponse)ex.Response) |
111 | { | 121 | { |
112 | if (!allowRegionless) | 122 | if (response.StatusCode == HttpStatusCode.NotFound) |
123 | { | ||
124 | if (!allowRegionless) | ||
125 | throw ex; | ||
126 | } | ||
127 | else | ||
128 | { | ||
113 | throw ex; | 129 | throw ex; |
130 | } | ||
114 | } | 131 | } |
115 | else | ||
116 | throw ex; | ||
117 | } | 132 | } |
118 | 133 | ||
119 | if (regionCount > 0 | allowRegionless) | 134 | if (regionCount > 0 | allowRegionless) |
135 | { | ||
120 | return regionInfos; | 136 | return regionInfos; |
137 | } | ||
121 | else | 138 | else |
122 | { | 139 | { |
123 | m_log.Error("[WEBLOADER]: No region configs were available."); | 140 | m_log.Error("[WEBLOADER]: No region configs were available."); |
@@ -127,4 +144,4 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
127 | } | 144 | } |
128 | } | 145 | } |
129 | } | 146 | } |
130 | } | 147 | } \ No newline at end of file |