diff options
author | Melanie Thielker | 2010-09-05 14:16:42 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-09-05 14:16:42 +0200 |
commit | e5936071711e35f9edf44d8393b8ad28ef4023db (patch) | |
tree | 72677e380cfcea4921eb910a93a1b985a4a4d6d1 /OpenSim/Framework/Servers/HttpServer | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-e5936071711e35f9edf44d8393b8ad28ef4023db.zip opensim-SC_OLD-e5936071711e35f9edf44d8393b8ad28ef4023db.tar.gz opensim-SC_OLD-e5936071711e35f9edf44d8393b8ad28ef4023db.tar.bz2 opensim-SC_OLD-e5936071711e35f9edf44d8393b8ad28ef4023db.tar.xz |
Remove "Dwell" support from core and replace it with calls to methods
on IDwellModule
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 109 |
1 files changed, 51 insertions, 58 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index f955df7..41ece86 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
57 | { | 57 | { |
58 | WebRequest request = WebRequest.Create(requestUrl); | 58 | WebRequest request = WebRequest.Create(requestUrl); |
59 | request.Method = verb; | 59 | request.Method = verb; |
60 | string respstring = String.Empty; | ||
60 | 61 | ||
61 | if ((verb == "POST") || (verb == "PUT")) | 62 | using (MemoryStream buffer = new MemoryStream()) |
62 | { | 63 | { |
63 | request.ContentType = "text/www-form-urlencoded"; | 64 | if ((verb == "POST") || (verb == "PUT")) |
64 | |||
65 | MemoryStream buffer = new MemoryStream(); | ||
66 | int length = 0; | ||
67 | using (StreamWriter writer = new StreamWriter(buffer)) | ||
68 | { | 65 | { |
69 | writer.Write(obj); | 66 | request.ContentType = "text/www-form-urlencoded"; |
70 | writer.Flush(); | ||
71 | } | ||
72 | 67 | ||
73 | length = (int)obj.Length; | 68 | int length = 0; |
74 | request.ContentLength = length; | 69 | using (StreamWriter writer = new StreamWriter(buffer)) |
70 | { | ||
71 | writer.Write(obj); | ||
72 | writer.Flush(); | ||
73 | } | ||
75 | 74 | ||
76 | Stream requestStream = null; | 75 | length = (int)obj.Length; |
77 | try | 76 | request.ContentLength = length; |
78 | { | ||
79 | requestStream = request.GetRequestStream(); | ||
80 | requestStream.Write(buffer.ToArray(), 0, length); | ||
81 | } | ||
82 | catch (Exception e) | ||
83 | { | ||
84 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
85 | } | ||
86 | finally | ||
87 | { | ||
88 | // If this is closed, it will be disposed internally, | ||
89 | // but the above write is asynchronous and may hit after | ||
90 | // we're through here. So the thread handling that will | ||
91 | // throw and put us back into the catch above. Isn't | ||
92 | // .NET great? | ||
93 | //if (requestStream != null) | ||
94 | // requestStream.Close(); | ||
95 | // Let's not close this | ||
96 | //buffer.Close(); | ||
97 | 77 | ||
78 | Stream requestStream = null; | ||
79 | try | ||
80 | { | ||
81 | requestStream = request.GetRequestStream(); | ||
82 | requestStream.Write(buffer.ToArray(), 0, length); | ||
83 | } | ||
84 | catch (Exception e) | ||
85 | { | ||
86 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
87 | } | ||
88 | finally | ||
89 | { | ||
90 | if (requestStream != null) | ||
91 | requestStream.Close(); | ||
92 | } | ||
98 | } | 93 | } |
99 | } | ||
100 | |||
101 | string respstring = String.Empty; | ||
102 | 94 | ||
103 | try | 95 | try |
104 | { | ||
105 | using (WebResponse resp = request.GetResponse()) | ||
106 | { | 96 | { |
107 | if (resp.ContentLength != 0) | 97 | using (WebResponse resp = request.GetResponse()) |
108 | { | 98 | { |
109 | Stream respStream = null; | 99 | if (resp.ContentLength != 0) |
110 | try | ||
111 | { | 100 | { |
112 | respStream = resp.GetResponseStream(); | 101 | Stream respStream = null; |
113 | using (StreamReader reader = new StreamReader(respStream)) | 102 | try |
114 | { | 103 | { |
115 | respstring = reader.ReadToEnd(); | 104 | respStream = resp.GetResponseStream(); |
105 | using (StreamReader reader = new StreamReader(respStream)) | ||
106 | { | ||
107 | respstring = reader.ReadToEnd(); | ||
108 | } | ||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
113 | } | ||
114 | finally | ||
115 | { | ||
116 | if (respStream != null) | ||
117 | respStream.Close(); | ||
116 | } | 118 | } |
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
121 | } | ||
122 | finally | ||
123 | { | ||
124 | if (respStream != null) | ||
125 | respStream.Close(); | ||
126 | } | 119 | } |
127 | } | 120 | } |
128 | } | 121 | } |
129 | } | 122 | catch (System.InvalidOperationException) |
130 | catch (System.InvalidOperationException) | 123 | { |
131 | { | 124 | // This is what happens when there is invalid XML |
132 | // This is what happens when there is invalid XML | 125 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); |
133 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); | 126 | } |
134 | } | 127 | } |
135 | return respstring; | 128 | return respstring; |
136 | } | 129 | } |