aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
authorDiva Canto2013-06-12 17:48:48 -0700
committerDiva Canto2013-06-12 17:48:48 -0700
commitb27121708490f0a6107a3e717e0cbe7792dfaaaf (patch)
tree0d1c3d204dc08b08c586d2a9567fbcf834944c51 /OpenSim/Framework/WebUtil.cs
parentDataSnapshot: changed those annoying messages to Debug instead of Info. (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-b27121708490f0a6107a3e717e0cbe7792dfaaaf.zip
opensim-SC_OLD-b27121708490f0a6107a3e717e0cbe7792dfaaaf.tar.gz
opensim-SC_OLD-b27121708490f0a6107a3e717e0cbe7792dfaaaf.tar.bz2
opensim-SC_OLD-b27121708490f0a6107a3e717e0cbe7792dfaaaf.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-rw-r--r--OpenSim/Framework/WebUtil.cs54
1 files changed, 52 insertions, 2 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 701fbb0..4599f62 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -151,6 +151,39 @@ namespace OpenSim.Framework
151 } 151 }
152 } 152 }
153 153
154 public static void LogOutgoingDetail(Stream outputStream)
155 {
156 using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8))
157 {
158 string output;
159
160 if (DebugLevel == 5)
161 {
162 const int sampleLength = 80;
163 char[] sampleChars = new char[sampleLength];
164 reader.Read(sampleChars, 0, sampleLength);
165 output = new string(sampleChars);
166 }
167 else
168 {
169 output = reader.ReadToEnd();
170 }
171
172 LogOutgoingDetail(output);
173 }
174 }
175
176 public static void LogOutgoingDetail(string output)
177 {
178 if (DebugLevel == 5)
179 {
180 output = output.Substring(0, 80);
181 output = output + "...";
182 }
183
184 m_log.DebugFormat("[WEB UTIL]: {0}", output.Replace("\n", @"\n"));
185 }
186
154 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) 187 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
155 { 188 {
156 int reqnum = RequestNumber++; 189 int reqnum = RequestNumber++;
@@ -178,7 +211,11 @@ namespace OpenSim.Framework
178 // If there is some input, write it into the request 211 // If there is some input, write it into the request
179 if (data != null) 212 if (data != null)
180 { 213 {
181 strBuffer = OSDParser.SerializeJsonString(data); 214 strBuffer = OSDParser.SerializeJsonString(data);
215
216 if (DebugLevel >= 5)
217 LogOutgoingDetail(strBuffer);
218
182 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); 219 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
183 220
184 if (compressed) 221 if (compressed)
@@ -357,6 +394,10 @@ namespace OpenSim.Framework
357 if (data != null) 394 if (data != null)
358 { 395 {
359 queryString = BuildQueryString(data); 396 queryString = BuildQueryString(data);
397
398 if (DebugLevel >= 5)
399 LogOutgoingDetail(queryString);
400
360 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); 401 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
361 402
362 request.ContentLength = buffer.Length; 403 request.ContentLength = buffer.Length;
@@ -767,6 +808,9 @@ namespace OpenSim.Framework
767 int length = (int)buffer.Length; 808 int length = (int)buffer.Length;
768 request.ContentLength = length; 809 request.ContentLength = length;
769 810
811 if (WebUtil.DebugLevel >= 5)
812 WebUtil.LogOutgoingDetail(buffer);
813
770 request.BeginGetRequestStream(delegate(IAsyncResult res) 814 request.BeginGetRequestStream(delegate(IAsyncResult res)
771 { 815 {
772 Stream requestStream = request.EndGetRequestStream(res); 816 Stream requestStream = request.EndGetRequestStream(res);
@@ -954,6 +998,9 @@ namespace OpenSim.Framework
954 length = (int)obj.Length; 998 length = (int)obj.Length;
955 request.ContentLength = length; 999 request.ContentLength = length;
956 1000
1001 if (WebUtil.DebugLevel >= 5)
1002 WebUtil.LogOutgoingDetail(buffer);
1003
957 Stream requestStream = null; 1004 Stream requestStream = null;
958 try 1005 try
959 { 1006 {
@@ -1096,6 +1143,9 @@ namespace OpenSim.Framework
1096 int length = (int)buffer.Length; 1143 int length = (int)buffer.Length;
1097 request.ContentLength = length; 1144 request.ContentLength = length;
1098 1145
1146 if (WebUtil.DebugLevel >= 5)
1147 WebUtil.LogOutgoingDetail(buffer);
1148
1099 Stream requestStream = null; 1149 Stream requestStream = null;
1100 try 1150 try
1101 { 1151 {
@@ -1198,4 +1248,4 @@ namespace OpenSim.Framework
1198 return deserial; 1248 return deserial;
1199 } 1249 }
1200 } 1250 }
1201} 1251} \ No newline at end of file