Commit Graph

67 Commits (eb413ec41e6ee49055464a636a73a7243c172c67)

Author SHA1 Message Date
Rider Linden bfabb7bd2b MAINT-6137: Re enable pipelining by default, use new version of CURL (7.47) with corrections for timed out connections in pipelining. Minor fix for safer op retrieval. 2016-02-19 11:19:50 -08:00
Rider Linden 8d334ca1bf MAINT-5271: Converted internal pointers to internal operation to managed shared pointers. Removed direct cast and dereference of handles. 2015-10-16 11:40:48 -07:00
Rider Linden 248d61fe0e MAINT-5500: Finish converting the AIS responders to the new coroutine model, Cleaned up dead an unused code.
MAINT-4952: Added COPY and MOVE methods to Core:Http adapter
2015-08-12 16:32:49 -07:00
Rider Linden 75b12d79e1 Enforcing constness of refs 2015-07-08 14:49:08 -07:00
Rider Linden fe5567639d Change HttpOptions::ptr_t to be shared_ptr<> rather than intrusive. 2015-07-08 12:09:36 -07:00
Rider Linden 1138c57f9a Convert LLCore::HttpHeaders to use shared_ptr<> rather than an intrusive_ptr<> for refrence counting. 2015-07-08 10:01:27 -07:00
Rider Linden 9703397551 MAINT-5295 Remove POSTFIELDS from PUT operation. 2015-06-24 10:10:22 -07:00
Rider Linden dde75d7621 Mac builds are very picking about testing an unsigned for < 0 2015-06-05 16:11:27 -07:00
Rider Linden daf4d167b6 Added a seek method to LLCore::Http for data rewind.
A couple of minor changes to merchant out box in hopes that the would fix the issues.
2015-06-05 15:19:24 -07:00
Rider Linden 83543e556c Memory leak (extra ref) in webprofile
Viewer media routines to coroutine.
Post with raw respons in llcorehttputil
LLCore::Http added headers only option (applies only on get)
2015-05-27 17:15:01 -07:00
Rider Linden d0c85b6dd9 Adding support for DELETE, PATCH and COPY 2015-04-10 17:23:58 -07:00
Rider Linden edc1439bd6 Added AvatarNameCache as coroutine, with LLCore::HttpHandler to respond correctly to Event Pumps.
Added get/setRequestURL() to LLCore::HttpResponse
Removed URI from the HttpSDHandler.
2015-04-01 16:37:00 -07:00
Rider Linden 7353640387 first set of chnages from code review from Nat 2015-03-27 17:00:02 -07:00
Rider Linden 6f4d36634e Removal of RPCXML dep on LLCurl switching to LLCore::Html 2015-03-16 17:14:34 -07:00
Oz Linden 6f3cf79a3a merge changes for 3.7.24-release 2015-01-13 13:46:45 -05:00
Nat Goodspeed 6be2f0ba2b Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2014-11-14 08:49:08 -05:00
Monty Brandenberg de9689e39b BUG-7698, BUG-7688, BUG-7694 (others) CDN connection issues.
Under pipelining, requests were given a 5x timeout factor due to the
way that the timeout clock works in libcurl.  Under CDN load,
connections were not being torn down quickly and it was only
this timer that led to disconnect and retry.  So, we want to
break a connection that isn't making progress but that isn't
immediately possible.  We'll compromise with a 60S timeout that
(we hope) will be neither too long for stalled connections nor
too short for large asset transfer requests.
2014-11-06 16:39:40 -05:00
callum_linden 217556cbaa Update to build on Xcode 6.0: remove unused code 2014-10-17 16:11:04 -07:00
callum_linden bc49197ea8 Update to build on Xcode 6.0: interesting - clang doesn't like it if you specify extra components of a format string that aren't populated in snprintf 2014-10-17 16:07:11 -07:00
Monty Brandenberg ec4fd2f0e2 MAINT-4564 HTTP Pipelining is not happening in Drano HTTP Phase 4
Incorporate the new libcurl 7.38.0 build with curl bug 1420
workaround.  Add developer-centric testing code to evaluate
the workaround or a future fix for 1420.
2014-10-10 16:43:04 -04:00
Monty Brandenberg 79ab7c2070 Introduce libcurl handle cache. Create a private cache
of used handles and a fast handle factory that's thread-
correct.
2014-09-19 15:34:09 -04:00
Monty Brandenberg 3057d246f0 Documentation. Describe curl bug 1420 testing and how to
reproduce data corruption via timeouts.
2014-09-18 18:42:30 -04:00
Monty Brandenberg 0c20beda68 Pipelining work. Extend transfer timeout by the pipeline depth
as transfers can appear delayed with deep pipelining and more
requests in the pool.  Added bad HTTP status error (typically
getting a 0 back as HTTP status from libcurl) to the list of
retryable errors.  There's a response stream problem with libcurl
and pipelining that induces this problem.  Retrying helps but
may not be entirely safe.  Watch bug 1420 on the libcurl sourceforge
bug tracker.  Extend options of test/example program to include
un-ranged requests.  Document the excessive data transfer induced
when ranged requests are disabled.  This is an abnormal mode for
very rare users so we'll just eat that for now.
2014-09-04 16:57:44 -04:00
Monty Brandenberg e79a88c8cc Better support for dynamic option changes in llcorehttp. Libcurl has
some problems disabling pipelining on a multi handle with outstanding
requests so build a more conservative system that allows requests
to drain before setting curl multi options.  Would rather not have
this but it is significantly safer.  "HttpPipelining" debug setting
is now fully dynamic.  Connection limits can also be made dynamic
in the near future.  Upped the default connection count back to 8 for
now but will revisit this in the tuning phase.  It might be time to
combine mesh and textures into a single asset class.  For normal
server operations that would be a clear path, but for server under
load, the current scheme may be better.  Minor cleanup in logging
to elminate some redundant strings.  Might add some more tracing to the
stall logic 'just in case'.
2014-08-12 18:21:26 -04:00
Brad Payne (Vir Linden) 895d52a399 merge viewer-release to sunshine-external 2014-02-25 13:25:40 -05:00
Brad Payne (Vir Linden) 1f8b37e9ad merge 2013-10-16 11:52:43 -04:00
Monty Brandenberg 6f5790da38 Merge. Pull in viewer-release after 3.6.7 release. 2013-10-04 15:36:52 -04:00
Monty Brandenberg 200bea5b41 SH-3690 SH-4505 Cleanup pass through code.
Start using DNS cache in legacy LLCurl code.  Go to 15 seconds
particularly as we're using threaded resolver at this point.
Documentation cleanup.  Add libcurl status checking and logging
for curl_easy_setopt() operations that fail.  Shouldn't happen
and we'll just continue anyway but there's info in the logs to
track these down now.  Cleaned up logic around FASTTIMER enable
defines used to evaluate pipeline stalls in main thread.
Removed long-standing thread race around caps strings and
URL construction.  Not a significant risk but refactoring the
code to get rid of them removed one huge eyesore.  It can be
made even slicker if desired (see notes).
2013-09-24 14:49:26 -04:00
Monty Brandenberg eff651cffc SH-4312 Configuration data between viewer and llcorehttp is clumsy.
Much improved.  Unified the global and class options into a single
option list.  Implemented static and dynamic setting paths as much
as possible.  Dynamic path does require packet/RPC but otherwise
there's near unification.  Dynamic modes can't get values back yet
due to the response/notifier scheme but this doesn't bother me.
Flatten global and class options into simpler struct-like entities.
Setter/getter available on these when needed (external APIs) but code
can otherwise fiddle directly when it knows what to do.  Much duplicated
options/state removed from HttpPolicy.  Comments cleaned up.  Threads
better described and consistently mentioned in API docs.  Integration
test extended for 503 responses with Reply-After headers.
2013-07-12 15:00:24 -04:00
Monty Brandenberg fb734d621e Found the memory corruptor. String trimmer didn't have a valid
termination test.  Sheesh.  Also get some more numbers out of the
example/load test program which drives traffic.  This should
give some useful insights into how the current http throttle
works (or doesn't) with varying client demands.
2013-07-08 20:31:09 +00:00
Monty Brandenberg d6cbcd591a SH-4257 Preparation for a new cap grant: GetMesh2
Mesh repo is using three policy classes now:  one for
large objects, one for GetMesh2 regions, one for
GetMesh regions.  It's also detecting the presence
of the cap and using the correct class.  Class
initialization cleaned up significantly in llappcorehttp
using data-directed code.  Pulled in the changes to
HttpHeader done for sunshine-internal then did a
refactoring pass on the header callback which now
uses a unified approach to clean up and deliver
header information to all interested parties.  Added
support for using Retry-After header information on
503 retries.
2013-06-20 19:18:39 -04:00
Brad Payne (Vir Linden) a04a706c1b merge 2013-05-21 16:18:48 -04:00
simon ee2fce8790 Merge downstream code and viewer-beta 2013-05-09 14:10:45 -07:00
Monty Brandenberg f5e8457e4e BUG-2295/MAINT-2624 unexpected crash around Content-Range: header processing
Not certain what the source of the short data is with one resident but I'm
going to make these problems retryable as they are transport-related.  Lift
the retry detection into a method that should be reusable by others interested
in determining what is retryable.  Trace output handling on the libcurl debug
callback was attrocious.  Some unsafe length handling on my part was protected
by a second layer of defense.  Made that correct and more useful by logging
actual data sizes during trace.
2013-05-06 12:12:05 -04:00
Monty Brandenberg f9850aa5d2 BUG-2295/MAINT-2624 [FIXED] Crash in HttpOpRequest::stageFromActive w/ Content-Range
Don't rely on a response body being present should a
Content-Range header be parsed.  Unit tests captured
the original crash and confirm the fix.
2013-04-29 17:09:13 -04:00
simon 6e483af1f6 Revert ares and libcurl version update that was causing problems, revise curl
handle duplication code.  Reviewed by Kelly
2013-04-25 14:14:35 -07:00
Monty Brandenberg 4eef1c8a2e SH-4106 Significantly upgrade the HttpHeaders interface for SSB.
Header container moves from a vector of raw lines to a vector
of string pairs representing name/value pairs in headers.  For
incoming headers, we normalize the name to lowercase and trim
it.  Values are only left-trimmed.  Outgoing headers are left
as-is.  Simple find() method for the common case, forward and
reverse iterators for those few who need to do it themselves.
The HTTP status line (e.g. 'HTTP/1.1 200 Ok') is no longer treated
as a header to be returned to caller.  Unit tests, as usual,
were a bear but they absolutely ensured outgoing HTTP header
conformance after the change.  Grunt work paid off.

LLTextureFetch was also given a second options structure
for texture fetches.  Same as the original but with header return
to caller requested.  Baked textures should use this, the other
20,000 texture fetch requests should continue to use the original.
2013-04-15 16:55:35 +00:00
Monty Brandenberg 626752beab SH-4252 Add second policy class for large mesh asset downloads
Added second mesh class as well as an asset upload class.
Refactored initialization to use less code and more data to
cleanly get http started.  Modified mesh to use the new
http class for large requests (>2MB for now).  Added additional
timeout setting to llcorehttp to distinguish connection timeout
from transport timeout and are now using transport timeout
values for large asset downloads that may need more time.
2013-06-19 13:55:54 -04:00
Monty Brandenberg 8868964b54 SH-4106 Significantly upgrade the HttpHeaders interface for SSB.
Header container moves from a vector of raw lines to a vector
of string pairs representing name/value pairs in headers.  For
incoming headers, we normalize the name to lowercase and trim
it.  Values are only left-trimmed.  Outgoing headers are left
as-is.  Simple find() method for the common case, forward and
reverse iterators for those few who need to do it themselves.
The HTTP status line (e.g. 'HTTP/1.1 200 Ok') is no longer treated
as a header to be returned to caller.  Unit tests, as usual,
were a bear but they absolutely ensured outgoing HTTP header
conformance after the change.  Grunt work paid off.

LLTextureFetch was also given a second options structure
for texture fetches.  Same as the original but with header return
to caller requested.  Baked textures should use this, the other
20,000 texture fetch requests should continue to use the original.
2013-04-15 16:55:35 +00:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Don Kjer 662d67e3b5 Merging LLCURL::Responder changes with CHUI changes. Fixed gcc 4.6 compile failures 2013-03-13 08:46:59 +00:00
Don Kjer f945415210 Large changes to the LLCurl::Responder API, as well as pulling in some changes to common libraries from the server codebase:
* Additional error checking in http handlers.
* Uniform log spam for http errors.
* Switch to using constants for http heads and status codes.
* Fixed bugs in incorrectly checking if parsing LLSD xml resulted in an error.
* Reduced spam regarding LLSD parsing errors in the default completedRaw http handler.  It should not longer be necessary to short-circuit completedRaw to avoid spam.
* Ported over a few bug fixes from the server code.
* Switch mode http status codes to use S32 instead of U32.
* Ported LLSD::asStringRef from server code; avoids copying strings all over the place.
* Ported server change to LLSD::asBinary; this always returns a reference now instead of copying the entire binary blob.
* Ported server pretty notation format (and pretty binary format) to llsd serialization.

* The new LLCurl::Responder API no longer has two error handlers to choose from.  Overriding the following methods have been deprecated:
** error - use httpFailure
** errorWithContent - use httpFailure
** result - use httpSuccess
** completed - use httpCompleted
** completedHeader - no longer necessary; call getResponseHeaders() from a completion method to obtain these headers.

* In order to 'catch' a completed http request, override one of these methods:
** httpSuccess - Called for any 2xx status code.
** httpFailure - Called for any non-2xx status code.
** httpComplete - Called for all status codes.  Default implementation is to call either httpSuccess or httpFailure.
* It is recommended to keep these methods protected/private in order to avoid triggering of these methods without using a 'push' method (see below).

* Uniform error handling should followed whenever possible by calling a variant of this during httpFailure:
** llwarns << dumpResponse() << llendl;
* Be sure to include LOG_CLASS(your_class_name) in your class in order for the log entry to give more context.

* In order to 'push' a result into the responder, you should no longer call error, errorWithContent, result, or completed.
* Nor should you directly call httpSuccess/Failure/Completed (unless passing a message up to a parent class).
* Instead, you can set the internal content of a responder and trigger a corresponding method using the following methods:
** successResult - Sets results and calls httpSuccess
** failureResult - Sets results and calls httpFailure
** completedResult - Sets results and calls httpCompleted

* To obtain information about a the response from a reponder method, use the following getters:
** getStatus - HTTP status code
** getReason - Reason string
** getContent - Content (Parsed body LLSD)
** getResponseHeaders - Response Headers (LLSD map)
** getHTTPMethod - HTTP method of the request
** getURL - URL of the request

* It is still possible to override completeRaw if you want to manipulate data directly out of LLPumpIO.

* See indra/llmessage/llcurl.h for more information.
2013-03-13 06:26:25 +00:00
Graham Madarasz (Graham) 2dcbbf04c9 Improve curl/ares init behavior by duping handles instead of calling easy_init 2013-02-28 09:45:43 -08:00
Monty Brandenberg 6c3375356e SH-3331 Fix incorrect overrun message when sending body with HTTP
request.  During readcallback, would generate an overrun-type message
about reading position beyond end-of-data.  Mistake was is messaging
when state is exactly at end of data (which is expected) versus an
overrun.  Both result in declaring end-of-data to libcurl.  Also
changed some of the status logging for the metrics payload to be
less chatty on success, more informative on error.
2012-12-21 22:21:58 +00:00
Monty Brandenberg 85e69b043b Big comment and naming cleanup. Ready for prime-time.
Add to-do list to _httpinternal.h to guide anyone who
wants to pitch in and help.
2012-07-23 23:40:07 +00:00
Monty Brandenberg 8d3e5f3959 SH-3241 Validate header correctness, SH-3243 more unit tests
Define expectations for headers for GET, POST, PUT requests.
Document those in the interface, test those with integration tests.
Verify that header overrides work as expected.
2012-07-16 17:35:44 -04:00
Monty Brandenberg d238341afa SH-3189 Remove/improve naive data structures
When releasing HTTP waiters, avoid unnecessary sort activity.
For Content-Type in responses, let libcurl do the work and removed
my parsing of headers.  Drop Content-Encoding as libcurl will deal
with that.  If anyone is interested, they can parse.
2012-07-16 11:53:04 -04:00
Monty Brandenberg 7010459f04 SH-3240 Capture Content-Type and Content-Encoding headers.
HttpResponse object now has two strings for these content headers.
Either or both may be empty.  Tidied up the cross-platform string
code and got more defensive about the length of a header line.
Integration test for the new response object.
2012-07-11 15:53:57 -04:00
Monty Brandenberg f5f51d3cda SH-3185 Fill in some FIXME/TODO cases
Also added some comments and changed the callback userdata argument
to be an HttpOpRequest rather than a libcurl handle.  Less code,
less clutter.
2012-07-07 19:35:32 -04:00
Monty Brandenberg f37b90df50 SH-3222 Slow loading textures on Lag Me 1
Think I have found the major factor that causes the Linksys WRT54G V5 to
fall over in testing scenarios:  DNS.  For some historical reason, we're
trying to use libcurl without any DNS caching.  My implementation echoed
that and implemented it correctly and I was seeing a DNS request per request
on the wire.  The existing implementation tries to do that and has bugs
because it is clearing caching DNS data querying only once every few
seconds.  Once I started emulating the bug, comms through the WRT became
much, much more reliable.
2012-07-06 18:09:17 -04:00