summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/tests
AgeCommit message (Collapse)Author
2013-05-13Whinge reduction effort on the unit tests. Python 2.7 SocketServerMonty Brandenberg
library has new exception-throwing behavior when a client disconnects unannounced. Generally ignore exceptions as a result as we don't care about the server side. On HTTP trace-mode tests, spin a little faster and longer to give libcurl time to emit all the junk it wants to send us. Should reduce 'reasonable time' failures on tests <12> and <13>.
2013-05-09Merge downstream code and viewer-betasimon
2013-05-06BUG-2295/MAINT-2624 unexpected crash around Content-Range: header processingMonty Brandenberg
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-04-29BUG-2295/MAINT-2624 [FIXED] Crash in HttpOpRequest::stageFromActive w/ ↵Monty Brandenberg
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-19merge up to latest viewer-development for merge to 3.5.2Oz Linden
2013-04-15SH-4106 Significantly upgrade the HttpHeaders interface for SSB.Monty Brandenberg
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-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2013-01-31skip some http core tests on Windows because they fail too frequentlyOz Linden
2012-09-07DRTVWR-209 Merge of viewer-development with SH-3316 drano-http code.Monty Brandenberg
Cmake files not merged correctly and had to be done by hand. New memory allocation made some memory usage tests in the llcorehttp integration tests no longer valid. Would like to work on LLLog sometime and get it to be consistent. Special flags needed for windows build of example program.
2012-07-16SH-3241 Validate header correctness, SH-3243 more unit testsMonty Brandenberg
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-16SH-3189 Remove/improve naive data structuresMonty Brandenberg
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-13SH-3241 validate that request headers are correctMonty Brandenberg
First round of integration tests. Added a request header 'reflector' to the web server to sent the client's headers back with a 'X-Reflect-' prefix. Use boost::regex to check various headers. Run a test on a simple GET and a byte-ranged GET a la texture fetch.
2012-07-12SH-3183 Use valgrind on the library.Monty Brandenberg
Using http_texture_load as the test subject, library looks clean. Did some better shutdown in the program itself and it looks better. Libcurl itself is making a lot of noise. Adapted testrunner to run valgrind as well but the memory allocation tester in the tools themselves grossly interferes with Valgrind operations.
2012-07-11SH-3240 Capture Content-Type and Content-Encoding headers.Monty Brandenberg
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-10SH-3244 Syscall avoidance in HttpRequest::update() methodMonty Brandenberg
Well, achieved that by doing work in bulk when needed. But turned into some additional things. Change timebase from mS to uS as, well, things are headed that way. Implement an HttpReplyQueue::fetchAll method (advertised one, hadn't implemented it).
2012-07-09Rework the 'sleep' logic in the test HTTP server so that theMonty Brandenberg
30-second hang doesn't break subsequent tests. Did this by introducing threads into the HTTP server as I can't find the magic to detect that my client has gone away.
2012-07-02Merge 3.3.3 release with Drano HTTP library at 3.3.0Monty Brandenberg
Big delta was converting the new texture debugger support code to the new library. Viewer manifest should probably get an eyeball before release.
2012-06-26SH-3184/SH-3221 More work on cleanup with better unit test work and more ↵Monty Brandenberg
aggressive shutdown of a thread. Some additional work let me enable a memory check for the clean shutdown case and generally do a better job on other interfaces. Request queue waiters now awake on shutdown and don't sleep once the queue is turned off. Much better semantically for how this will be used.
2012-06-23SH-3184/SH-3221 Improve cleanup, destructor, thread termination, etc. logic ↵Monty Brandenberg
in library. With this commit, the cleanup paths should be production quality. Unit tests have been expanded to include cases requiring thread termination and cleanup by the worker thread. Special operation/request added to support the unit tests. Thread interface expanded to include a very aggressive cancel() method that does not do cleanup but prevents the thread from accessing objects that will be destroyed.
2012-06-22SH-3177, SH-3180 std::iostream and LLSD serialization for BufferArray objects.Monty Brandenberg
Seems to be working correctly. Not certain this is the fastest possible way to provide a std::streambuf interface but it's visually acceptable.
2012-06-22Always another platform build fix. Mac this time.Monty Brandenberg
2012-06-21Preparing for better shutdown/cleanup logic.Monty Brandenberg
2012-06-21Compiler warning fix on linux.Monty Brandenberg
2012-06-21SH-3177 Add streambuf/iostream adapters to BufferArray object.Monty Brandenberg
Initial version that should have enough of the plumbing to produce a working adapter. Memory test is showing 8 bytes held after one of the tests so I'm going to revisit that later. But basic functionality is there going by the unit tests.
2012-06-20SH-3181 More interface options for API. Also includes returned headers.Monty Brandenberg
Only thing interesting in this changeset is the discovery that a sleep in the fake HTTP server ties up tests. Need to thread that or fail on client disconnect or something to speed that up and make it usable for bigger test scenarios. But good enough for now...
2012-06-19Implement timeout and retry count options for requests.Monty Brandenberg
Pretty straightforward. Still don't like how I'm managing the options block. Struct? Accessors? Can't decide. But the options now speed up the unit test runs even as I add tests.
2012-06-14LLMutex recursive lock, global & per-request tracing, simple GET request, ↵Monty Brandenberg
LLProxy support, HttpOptions starting to work, HTTP resource waiting fixed. Non-LLThread-based threads need to do some registration or LLMutex locks taken out in these threads will not work as expected (SH-3154). We'll get a better solution later, this fixes some things for now. Tracing of operations now supported. Global and per-request (via HttpOptions) tracing levels of [0..3]. The 2 and 3 levels use libcurl's VERBOSE mode combined with CURLOPT_DEBUGFUNCTION to stream high levels of detail into the log. *Very* laggy but useful. Simple GET request supported (no Range: header). Really just a degenrate case of a ranged get but supplied an API anyway. Global option to use the LLProxy interface to setup CURL handles for either socks5 or http proxy usage. This isn't really the most encapsulated way to do this but a better solution will have to come later. The wantHeaders and tracing options are now supported in HttpOptions giving per-request controls. Big refactoring of the HTTP resource waiter in lltexturefetch. What I was doing before wasn't correct. Instead, I'm implementing the resource wait after the Semaphore model (though not using system semaphores). So instead of having a sequence like: SEND_HTTP_REQ -> WAIT_HTTP_RESOURCE -> SEND_HTTP_REQ, we now do WAIT_HTTP_RESOURCE -> WAIT_HTTP_RESOURCE2 (actual wait) -> SEND_HTTP_REQ. Works well but the prioritized filling of the corehttp library needs some performance work later.
2012-06-12HTTP Proxy, PUT & POST, unit tests and refactoring.Monty Brandenberg
Implemented/modified PUT & POST to not used chunked encoding for the request. Made the unit test much happier and probably a better thing for the pipeline. Have a cheesy static & dynamic proxy capability using both local options and a way to wire into LLProxy in llmessages. Not a clean thing but it will get the proxy path working with both socks5 & http proxies. Refactoring to get rid of unneeded library handler and unified an HttpStatus return for all requests. Big batch of code removed as a result of that and more is possible as well as some syscall avoidance with a bit more work. Boosted the unit tests for simple PUT & POST test which revealed the test harness does *not* like chunked encoding so we'll avoid it for now (and don't really need it in any of our schemes).
2012-06-11Bring in the testrunner/http server scaffold for better integration testing.Monty Brandenberg
This brings in a copy of llmessage's llsdmessage testing server. We run a mocked HTTP service to handle requests and the integration tests run against it by picking up the LL_TEST_PORT environment variable when running. Add some checks and output to produce useful info when run in the wrong environment and when bad status is received. Later will add a dead port as well so we can test that rather than use 'localhost:2'.
2012-06-11Convert BufferArray interfaces to void * (not char *). ↵Monty Brandenberg
HttpRequest::update() honor time limit. Generally, opaque data operations are expected to be over 'void *' and have now converted interfaces to do that. Update() method honors millisecond limit to dwell time. Might want to homologate the millis/uSecs mix later....
2012-06-11Unit test fixups. Mac/Linux detect memory leak due to llwarns, try/catch ↵Monty Brandenberg
cleanup. Our logging holds on to a changing bit of memory between operations and the memory leak detection I'm using senses this and complains. So, for now, disable the final memory check on Mac & Linux, leave it active on Windows. Solve this for real some other day. Add try/catch blocks to do cleanup in unit tests that go wrong so that we don't get a cascade of assertion failures when subsequent tests find singletons still alive.
2012-06-08Implemented HTTP retry for requests. Went in rather easily whichMonty Brandenberg
surprised me. Added a retry queue similar to ready queue to the policy object which is sorted by retry time. Currently do five retries (after the initial try) delayed by .25, .5, 1, 2 and 5 seconds. Removed the retry logic from the lltexturefetch module. Upped the waiting time in the unit test for the retries. People won't like this but tough, need tests.
2012-06-01Do some work on BufferArray to make it a bit less naive aboutMonty Brandenberg
chunking data. Remove the stateful use of a seek pointer so that shared read is possible (though maybe not interesting).
2012-06-01Major steps towards implementing the policy component.Monty Brandenberg
Identified and reacted to the priority inversion problem we have in texturefetch. Includes the introduction of a priority_queue for the requests that are ready. Start some parameterization in anticipation of having policy_class everywhere. Removed _assert.h which isn't really needed in indra codebase. Implemented async setPriority request (which I hope I can get rid of eventually along with all priorities in this library). Converted to using unsigned int for priority rather than float. Implemented POST and did groundwork for PUT.
2012-05-23Integrate llcorehttp library into lltexturefetch design.Monty Brandenberg
This is the first functional viewer pass with the HTTP work of the texture fetch code performed by the llcorehttp library. Not exactly a 'drop-in' replacement but a work-alike with some changes (e.g. handler notification in consumer thread versus responder notification in worker thread). This also includes some temporary changes in the priority scheme to prevent the kind of priority inversion found in VWR-28996. Scheme used here does provide liveness if not optimal responsiveness or order-of-operation. The llcorehttp library at this point is far from optimally performing. Its worker thread is making relatively poor use of cycles it gets and it doesn't idle or sleep intelligently yet. This early integration step helps shake out the interfaces, implementation niceties will be covered soon.
2012-05-09Added correct libcurl initialization to the unit tests which makes Windows ↵Monty Brandenberg
builds reliable. It's the right thing to do and introduced a scoped version for convenience in tests.
2012-05-09Try to get some more correct curl init into the unit testing.Monty Brandenberg
2012-05-08Okay, got Mac building with Boost 1.48. Unit tests needed NULL pointerMonty Brandenberg
defenses in the delete functions of the allocation support. General boost library renaming again. Linux builds in TC though it shouldn't based on what Boost.cmake lookes like...
2012-05-07Build llcorehttp as part of a viewer dependency with unit tests. This requiredMonty Brandenberg
boost::thread and the easiest path to that was to go with the 1.48 Boost release in the 3P tree (eliminating a fork for a modified 1.45 packaging). One unit test, the most important one, is failing in test_httprequest but that can be attended to later. This test issues a GET to http://localhost:2/ and that is hitting the wire but the libcurl plumbing isn't delivering the failure, only the eventual timeout. An unexpected change in behavior.
2012-04-23Okay, imported the core-http library and got it compiling suspiciously easily.Monty Brandenberg
The unit/integration tests don't work yet as I'm still battling cmake/autobuild as usual but first milestone passed.