Commit Graph

76 Commits (faf9ba53fc10d8abcc9e58e98cc887c1f0f49696)

Author SHA1 Message Date
Justin Clark-Casey (justincc) faf9ba53fc In SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) actually set timeout on WebRequest if given.
Previously, we were doing nothing with this parameter.
No effect on current code since none of the 6 callers attempt to use the timeout.
2014-05-12 19:20:00 +01:00
Oren Hurvitz 88f7a833dc Improved HTTP logging 2014-04-29 07:59:17 +01:00
Oren Hurvitz bc06db3df4 - Created a standard function to send XML-RPC requests, which logs them like we do for other types of HTTP activity.
- Changed OpenProfileClient to use the new XML-RPC sending function
- Improved logging in WebUtil
2014-04-24 15:58:43 +01:00
Oren Hurvitz d15a3b10a3 When sending JSON-RPC calls (for UserProfile), use WebUtil instead of constructing the HTTP requests manually. This allows the calls to be logged when using "debug http all 6". 2014-04-24 15:58:41 +01:00
Oren Hurvitz bbfda8e19e Fixed last-resort sending of error response (HTTP 500) when an error occurs while handling a request.
The previous code didn't actually send the response, so the caller was stuck until the timeout (100 seconds).
2014-04-02 06:32:41 +01:00
Oren Hurvitz 161c827a44 Fixed a case where logging an HTTP response failed because the stream was non-seekable 2014-03-27 17:46:37 +02:00
Oren Hurvitz 76add0fdb0 Log errors in MakeRequest() as INFO, not ERROR. Some communications problems are benign (e.g., can't send Friend status update to a region that is down), so don't log them as ERROR so soon. We rethrow the exception, so the caller can still decide to log the error as an ERROR.
Resolves http://opensimulator.org/mantis/view.php?id=7077
2014-03-27 15:00:42 +01:00
Oren Hurvitz 6d1d58b654 Use the "X-Content-Encoding" header to indicate gzipped data, because old OpenSims fail if they get an unknown "Content-Encoding" 2014-03-25 18:09:23 +01:00
Oren Hurvitz b1d8aa0b64 Use the "Content-Encoding" header to indicate gzipped streams 2014-03-25 15:36:59 +01:00
Oren Hurvitz f90aee696a Always throw an exception if MakeRequest (used for HTTP POST) fails. (Previously many exceptions were ignored)
Resolves http://opensimulator.org/mantis/view.php?id=6949
2014-03-25 09:37:10 +01:00
Oren Hurvitz f901a38204 Improved logging of HTTP requests
- MemoryBuffer isn't seekable, so we can't log it. Log the string instead.
- Handle compressed streams
- Don't attempt to dump binary data. Either don't log it at all (if we know it's binary), or at least convert non-ASCII characters to ASCII.
- Log responses to HTTP requests
- Use the same log prefix for all of these log messages ("[LOGHTTP]"), to make them easy to see at a glance
- Increased the snippet length to 200 (80 doesn't show enough), and add "..." only if the message was actually truncated

Resolves http://opensimulator.org/mantis/view.php?id=6949
2014-03-25 09:36:53 +01:00
Justin Clark-Casey (justincc) 88b1fc1382 Set up a StreamReader and call ReadToEnd() instead of using the GetStreamString() extension method
This eliminates some stream seeking that was never necessary and makes disposable of the StreamReader consistent with other code
2014-02-27 23:13:26 +00:00
Justin Clark-Casey (justincc) 5fafea6631 refactor: More consistently use using construct within WebUtil to match other existing code there. 2014-02-27 22:52:43 +00:00
Justin Clark-Casey (justincc) 1f4f09ad69 Add more details to InvalidOperationException logging in SychronousRestFormsRequest.MakeRequest(). 2014-02-27 20:35:56 +00:00
Oren Hurvitz b8e22f02e7 Make sure Web streams are disposed after use 2014-01-31 00:44:22 +00:00
Justin Clark-Casey (justincc) 7cab41f422 refactor: replace verbose checks with String.IsNullOrEmpty where applicable.
Thanks to Kira for this patch from http://opensimulator.org/mantis/view.php?id=6845
2013-11-15 21:45:08 +00:00
Justin Clark-Casey (justincc) 9bcf072795 Make it possible to switch whether we serialize osd requests per endpoint or not, either via config (SerializeOSDRequests in [Network]) or via the "debug comms set" console command.
For debug purposes to assess what impact this has on network response in a heavy test environment.
2013-08-05 23:44:48 +01:00
Diva Canto 5198df3aa0 Issue: 10 simultaneous TPs, many not making it. Now bypassing the per-url lock -- we should be "ok" (or, more "ok") now that we have increased the connection limit on the http library. But this is a sensitive part of the code, so it may need reverting. 2013-08-02 17:00:18 -07:00
Diva Canto 33ddb6c246 Revert "WARNING: BRUTE FORCE DEBUG. AVOID USING THIS COMMIT."
This reverts commit c95a23863a.
2013-07-04 13:25:58 -07:00
Diva Canto c95a23863a WARNING: BRUTE FORCE DEBUG. AVOID USING THIS COMMIT. 2013-07-04 13:13:52 -07:00
Diva Canto 00093a305d Changed HG status notifications timeout down to 15secs from the default 100. 2013-06-29 18:35:23 -07:00
Justin Clark-Casey (justincc) 47b6e78790 Implement logging of first 80 characters (debug level 5) or full body data (debug level 6) on outgoing requests, depending on debug level
This is set via "debug http out <level>"
This matches the existing debug level behaviours for logging incoming http data
2013-06-12 21:34:20 +01:00
Justin Clark-Casey (justincc) 80c19b7cac Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already. 2013-02-27 00:21:02 +00:00
Melanie 503ce70f74 Allow setting connection limits, part 2 2012-09-30 16:31:23 +01:00
Diva Canto 91a5c602e3 Revert "Added request.Proxy=null everywhere, as discussed in http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow."
But the patch is here, in case anyone wants to try it.

This reverts commit 531edd51d8.
2012-09-30 07:48:03 -07:00
Diva Canto 531edd51d8 Added request.Proxy=null everywhere, as discussed in http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow.
Thanks R.Gunther (rigun@rigutech.nl) https://lists.berlios.de/pipermail/opensim-users/2012-September/010986.html
2012-09-30 07:22:55 -07:00
Justin Clark-Casey (justincc) 80f486c778 minor: Make slow outgoing request log messages consistent with other log messages 2012-09-21 01:59:28 +01:00
Justin Clark-Casey (justincc) e29d563557 Add request number counting to incoming HTTP requests in the same way that this was already being done for outgoing HTTP requests.
This allows us to associate debug logging messages with the right request.
It also allows us to put a request number on 'long request' logging even if other debug logging is not enabled, which gives us some idea of whether every request is suffering this problem or only some.
This is a separate internal number not associated with any incoming number in the opensim-request-id header, this will be clarified when logging of this incoming request number is re-enabled.
This commit also adds port number to HTTP IN logging to allow us to distinguish between different request numbers on different ports.
2012-09-21 00:09:17 +01:00
Justin Clark-Casey (justincc) a5b3989e5d Insert a new log level 4 for HTTP IN and HTTP OUT that will log how long the request took.
This is only printed if debug http level >= 4 and the request didn't take more than the time considered 'long', in which case the existing log message is printed.
This displaces the previous log levels 4 and 5 which are now 5 and 6 respectively.
2012-09-20 23:18:19 +01:00
Justin Clark-Casey (justincc) 387a1bb283 Add ability to turn on/off logging of outgoing HTTP requests flowing through WebUtil.
This is for debugging purposes.
This is controlled via the "debug http" command which can already log incoming requests.
This now gains a mandatory parameter of in, out or all to control what is logged.
Log messages are also shortened and labelled and HTTP IN or HTTP OUT to be consistent with existing UDP PACKET IN and PACKET OUT messages.
2012-09-20 23:17:44 +01:00
Justin Clark-Casey (justincc) 6096a1f30e Change LongCallTime on WebUtil to 3000, to match the time where request handling is considered "slow".
This may be the wrong thing to do but stops lots of log spam in HG setups now that the monitoring is extended to other outgoing calls.
LongCallTime may need to be made configurable.
2012-05-04 20:53:30 +01:00
Justin Clark-Casey (justincc) c9faf0df74 Extend 'slow' request logging to other server outbound requests (forms, rest, async rest) as well as the existing logging on outbound OSD requests.
Also prints out the first 100 chars of any slow request data since this can contain useful info (such as agent ID).
2012-05-04 01:12:56 +01:00
Justin Clark-Casey (justincc) 4c4ffb9868 Add request verb and url to error messages in WebUtil that lack this.
Make exception printing consistent across windows and mono.
2012-04-26 00:43:31 +01:00
Robert Adams e0dd38f672 Rename the stream extension method WebUtil.CopyTo() to WebUtil.CopyStream().
.NET 4.0 added the method Stream.CopyTo(stream, bufferSize). For .NET 3.5
and before, WebUtil defined an extension method for Stream with the signature
Stream.CopyTo(stream, maxBytesToCopy). The meaning of the second parameter
is different in the two forms and depending on which compiler and/or
runtime you use, you could get one form or the other. Crashes ensue.
This change renames the WebUtil stream copy method to something that
cannot be confused with the new CopyTo method defined in .NET 4.0.
2012-03-12 10:07:04 -07:00
Mic Bowman 7b8e9d88e3 Serialize all web requests to a particular host:port pair; only applied to the PostToService variants. 2012-03-09 16:53:51 -08:00
Mic Bowman 4268427ac3 Some clean up in WebUtil, remove unused ServiceRequest function. 2012-02-27 15:15:03 -08:00
Justin Clark-Casey (justincc) b785f204ce remove some mono compiler warnings 2011-11-25 22:19:57 +00:00
Justin Clark-Casey (justincc) 10a23a823e Get rid of the spurious [WEB UTIL] couldn't decode <OpenSim agent 57956c4b-ff2e-4fc1-9995-613c6256cc98>: Invalid character 'O' in input string messages
These are just the result of an attempt to canonicalize received messages - it's not important that we constantly log them.
Also finally get the deregister grid service message working properly
2011-11-19 01:16:07 +00:00
Justin Clark-Casey (justincc) 8a0a78cbcc Make OpenSim.Framework.Servers.HttpServer rely on OpenSim.Framework instead of the other way around.
This is necessary so that code in HttpServer can use framework facilities such as the thread watchdog for monitoring purposes.
Doing this shuffle meant that MainServer was moved into OpenSim/Framework/Servers
Also had to make OpenSim.Framework.Console rely on OpenSim.Framework rather than the other way around since it in turn relies on HttpServer
MainConsole and some new interfaces had to be moved into OpenSim/Framework to allow this.  This can be reverted if parts of OpenSim.Framework stop relying on console presence (cheifly RegionInfo)
2011-10-25 20:24:21 +01:00
Justin Clark-Casey (justincc) c7e8529122 minor: remove whitespace 2011-07-13 01:25:17 +01:00
Justin Clark-Casey (justincc) 0d64155bb5 Remove an unused 404 checker since on a 404, GetResponse() throws a WebException rather than proceeding. 2011-07-13 01:24:22 +01:00
Justin Clark-Casey (justincc) 938b4f8bf8 if a SynchronousRestObjectRequester request fails, then unless it's due to a 404, log the exception for diagnostic purposes
This is instead of logging "Invalid XML" for all failures, even if they weren't a result of invalid xml.
A default TReponse is returned in the event of a 404, which is the same behaviour as previously.
2011-07-13 01:19:12 +01:00
Justin Clark-Casey (justincc) e434ba5e8e Remove the obsoleted SynchronousRestObjectPoster 2011-07-13 00:52:32 +01:00
Diva Canto a2f034c554 Changed yet more Warns to Debugs. 2011-05-14 13:36:55 -07:00
Diva Canto be6feff331 Also changed a couple of messages in WebUtil from Wanr/Info to Debug. 2011-05-14 13:09:59 -07:00
Diva Canto a3aa839d75 Stop spamming Nebadon's console when assets aren't found in the asset server. 2011-05-14 12:56:50 -07:00
Diva Canto e39dec6f37 Hopefully this fixes offline messages. The problem was: the server is not setting the ContentLength of the response. That comes up to OpenSim as ContentLength=-1, which made the existing test fail. 2011-05-12 20:48:24 -07:00
Diva Canto 1cc70df3b4 One more thing printed out. #OfflineIM 2011-05-12 20:20:08 -07:00
Diva Canto 301321c853 Instrument the heck out of offline messages. THIS IS VERY VERBOSE. 2011-05-12 19:56:59 -07:00
Diva Canto 691283c44e One more debug message for offline IMs. 2011-05-12 19:10:44 -07:00