aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lliohttpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index 5c96102..3c8010b 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -53,6 +53,7 @@
53 53
54static const char HTTP_VERSION_STR[] = "HTTP/1.0"; 54static const char HTTP_VERSION_STR[] = "HTTP/1.0";
55static const std::string CONTEXT_REQUEST("request"); 55static const std::string CONTEXT_REQUEST("request");
56static const std::string CONTEXT_RESPONSE("response");
56static const std::string HTTP_VERB_GET("GET"); 57static const std::string HTTP_VERB_GET("GET");
57static const std::string HTTP_VERB_PUT("PUT"); 58static const std::string HTTP_VERB_PUT("PUT");
58static const std::string HTTP_VERB_POST("POST"); 59static const std::string HTTP_VERB_POST("POST");
@@ -156,10 +157,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
156 LLBufferStream istr(channels, buffer.get()); 157 LLBufferStream istr(channels, buffer.get());
157 158
158 static LLTimer timer; 159 static LLTimer timer;
159 if (sTimingCallback) 160 timer.reset();
160 {
161 timer.reset();
162 }
163 161
164 std::string verb = context[CONTEXT_REQUEST]["verb"]; 162 std::string verb = context[CONTEXT_REQUEST]["verb"];
165 if(verb == HTTP_VERB_GET) 163 if(verb == HTTP_VERB_GET)
@@ -189,6 +187,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
189 mResponse->methodNotAllowed(); 187 mResponse->methodNotAllowed();
190 } 188 }
191 189
190 F32 delta = timer.getElapsedTimeF32();
192 if (sTimingCallback) 191 if (sTimingCallback)
193 { 192 {
194 LLHTTPNode::Description desc; 193 LLHTTPNode::Description desc;
@@ -197,16 +196,20 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
197 std::string timing_name = info["description"]; 196 std::string timing_name = info["description"];
198 timing_name += " "; 197 timing_name += " ";
199 timing_name += verb; 198 timing_name += verb;
200 F32 delta = timer.getElapsedTimeF32();
201 sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData); 199 sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData);
202 } 200 }
203 201
202 // Log all HTTP transactions.
203 llinfos << verb << " " << context[CONTEXT_REQUEST]["path"].asString()
204 << " " << mStatusCode << " " << mStatusMessage << " " << delta
205 << "s" << llendl;
206
204 // Log Internal Server Errors 207 // Log Internal Server Errors
205 if(mStatusCode == 500) 208 //if(mStatusCode == 500)
206 { 209 //{
207 llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error" 210 // llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error"
208 << llendl; 211 // << llendl;
209 } 212 //}
210 } 213 }
211 214
212 PUMP_DEBUG; 215 PUMP_DEBUG;
@@ -223,7 +226,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
223 226
224 case STATE_GOOD_RESULT: 227 case STATE_GOOD_RESULT:
225 { 228 {
226 context["response"]["contentType"] = "application/xml"; 229 context[CONTEXT_RESPONSE]["contentType"] = "application/xml";
227 LLBufferStream ostr(channels, buffer.get()); 230 LLBufferStream ostr(channels, buffer.get());
228 LLSDSerialize::toXML(mGoodResult, ostr); 231 LLSDSerialize::toXML(mGoodResult, ostr);
229 232
@@ -232,9 +235,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
232 235
233 case STATE_STATUS_RESULT: 236 case STATE_STATUS_RESULT:
234 { 237 {
235 context["response"]["contentType"] = "text/plain"; 238 context[CONTEXT_RESPONSE]["contentType"] = "text/plain";
236 context["response"]["statusCode"] = mStatusCode; 239 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
237 context["response"]["statusMessage"] = mStatusMessage; 240 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;
238 LLBufferStream ostr(channels, buffer.get()); 241 LLBufferStream ostr(channels, buffer.get());
239 ostr << mStatusMessage << std::ends; 242 ostr << mStatusMessage << std::ends;
240 243
@@ -371,9 +374,9 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
371 PUMP_DEBUG; 374 PUMP_DEBUG;
372 //mGotEOS = true; 375 //mGotEOS = true;
373 std::ostringstream ostr; 376 std::ostringstream ostr;
374 std::string message = context["response"]["statusMessage"]; 377 std::string message = context[CONTEXT_RESPONSE]["statusMessage"];
375 378
376 int code = context["response"]["statusCode"]; 379 int code = context[CONTEXT_RESPONSE]["statusCode"];
377 if (code < 200) 380 if (code < 200)
378 { 381 {
379 code = 200; 382 code = 200;
@@ -382,7 +385,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
382 385
383 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; 386 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n";
384 387
385 std::string type = context["response"]["contentType"].asString(); 388 std::string type = context[CONTEXT_RESPONSE]["contentType"].asString();
386 if (!type.empty()) 389 if (!type.empty())
387 { 390 {
388 ostr << "Content-Type: " << type << "\r\n"; 391 ostr << "Content-Type: " << type << "\r\n";