diff --git a/indra/cwdebug/debug.cc b/indra/cwdebug/debug.cc index de14fa99f..ed1384306 100644 --- a/indra/cwdebug/debug.cc +++ b/indra/cwdebug/debug.cc @@ -236,8 +236,9 @@ void stop_recording_backtraces(void) channel_ct backtrace DDCN("BACKTRACE"); //!< This debug channel is used for backtraces. channel_ct statemachine DDCN("STATEMACHINE"); //!< This debug channel is used for output related to class AIStateMachine. channel_ct caps DDCN("CAPS"); //!< This debug channel is used for output related to Capabilities. - channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to Curl. - channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl. + channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to AICurl. + channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl. This includes all HTTP network traffic. + channel_ct curltr DDCN("CURLTR"); //!< This debug channel is used to print libcurl API calls. } // namespace dc } // namespace DEBUGCHANNELS diff --git a/indra/cwdebug/debug.h b/indra/cwdebug/debug.h index 1deed2efb..c1b509946 100644 --- a/indra/cwdebug/debug.h +++ b/indra/cwdebug/debug.h @@ -207,6 +207,7 @@ extern CWD_API channel_ct statemachine; extern CWD_API channel_ct caps; extern CWD_API channel_ct curl; extern CWD_API channel_ct curlio; +extern CWD_API channel_ct curltr; #endif diff --git a/indra/llmessage/aicurl.cpp b/indra/llmessage/aicurl.cpp index 8396b195c..e1568ea6b 100644 --- a/indra/llmessage/aicurl.cpp +++ b/indra/llmessage/aicurl.cpp @@ -545,6 +545,9 @@ void CurlEasyHandle::handle_easy_error(CURLcode code) // Throws AICurlNoEasyHandle. CurlEasyHandle::CurlEasyHandle(void) : mActiveMultiHandle(NULL), mErrorBuffer(NULL), mQueuedForRemoval(false) +#ifdef DEBUG_CURLIO + , mDebug(false) +#endif #ifdef SHOW_ASSERT , mRemovedPerCommand(true) #endif @@ -588,6 +591,12 @@ CurlEasyHandle::~CurlEasyHandle() llassert(!mActiveMultiHandle); curl_easy_cleanup(mEasyHandle); Stats::easy_cleanup_calls++; +#ifdef DEBUG_CURLIO + if (mDebug) + { + debug_curl_remove_easy(mEasyHandle); + } +#endif } //static diff --git a/indra/llmessage/aicurl.h b/indra/llmessage/aicurl.h index b7599c817..74ac68dcc 100644 --- a/indra/llmessage/aicurl.h +++ b/indra/llmessage/aicurl.h @@ -271,6 +271,11 @@ class AICurlEasyRequest { // Queue a command to remove this request from the multi session (or cancel a queued command to add it). void removeRequest(void); +#ifdef DEBUG_CURLIO + // Turn on/off debug output. + void debug(bool debug) { AICurlEasyRequest_wat(*mBufferedCurlEasyRequest)->debug(debug); } +#endif + private: // The actual pointer to the ThreadSafeBufferedCurlEasyRequest instance. AICurlPrivate::BufferedCurlEasyRequestPtr mBufferedCurlEasyRequest; diff --git a/indra/llmessage/aicurlprivate.h b/indra/llmessage/aicurlprivate.h index 86ae1321c..ece689c34 100644 --- a/indra/llmessage/aicurlprivate.h +++ b/indra/llmessage/aicurlprivate.h @@ -201,12 +201,19 @@ class CurlEasyHandle : public boost::noncopyable, protected AICurlEasyHandleEven // In case it's added after being removed. void add_queued(void) { mQueuedForRemoval = false; } +#ifdef DEBUG_CURLIO + void debug(bool debug) { if (mDebug) debug_curl_remove_easy(mEasyHandle); if (debug) debug_curl_add_easy(mEasyHandle); mDebug = debug; } +#endif + private: CURL* mEasyHandle; CURLM* mActiveMultiHandle; mutable char* mErrorBuffer; AIPostFieldPtr mPostField; // This keeps the POSTFIELD data alive for as long as the easy handle exists. bool mQueuedForRemoval; // Set if the easy handle is (probably) added to the multi handle, but is queued for removal. +#ifdef DEBUG_CURLIO + bool mDebug; +#endif #ifdef SHOW_ASSERT public: bool mRemovedPerCommand; // Set if mActiveMultiHandle was reset as per command from the main thread. diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index 7553dd574..d1b61cd7b 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -1822,7 +1822,7 @@ bool HTTPTimeout::data_received(size_t n) // | | | | | | | | | | | | | | bool HTTPTimeout::lowspeed(size_t bytes) { - DoutCurlEntering("HTTPTimeout::lowspeed(" << bytes << ")"); + //DoutCurlEntering("HTTPTimeout::lowspeed(" << bytes << ")"); commented out... too spammy for normal use. // The algorithm to determine if we timed out if different from how libcurls CURLOPT_LOW_SPEED_TIME works. // @@ -2367,14 +2367,25 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size } #if defined(CWDEBUG) || defined(DEBUG_CURLIO) -int debug_callback(CURL*, curl_infotype infotype, char* buf, size_t size, void* user_ptr) +int debug_callback(CURL* handle, curl_infotype infotype, char* buf, size_t size, void* user_ptr) { BufferedCurlEasyRequest* request = (BufferedCurlEasyRequest*)user_ptr; + if (infotype == CURLINFO_HEADER_OUT && size >= 5 && (strncmp(buf, "GET ", 4) == 0 || strncmp(buf, "HEAD ", 5) == 0)) + { + request->mDebugIsHeadOrGetMethod = true; + } + +#ifdef DEBUG_CURLIO + if (!debug_curl_print_debug(handle)) + { + return 0; + } +#endif #ifdef CWDEBUG using namespace ::libcwd; std::ostringstream marker; - marker << (void*)request->get_lockobj(); + marker << (void*)request->get_lockobj() << ' '; libcw_do.push_marker(); libcw_do.marker().assign(marker.str().data(), marker.str().size()); if (!debug::channels::dc::curlio.is_on()) @@ -2398,8 +2409,6 @@ int debug_callback(CURL*, curl_infotype infotype, char* buf, size_t size, void* break; case CURLINFO_HEADER_OUT: LibcwDoutStream << "H< "; - if (size >= 5 && (strncmp(buf, "GET ", 4) == 0 || strncmp(buf, "HEAD ", 5) == 0)) - request->mDebugIsHeadOrGetMethod = true; break; case CURLINFO_DATA_IN: LibcwDoutStream << "D> "; diff --git a/indra/llmessage/debug_libcurl.cpp b/indra/llmessage/debug_libcurl.cpp index d0bcbb602..0a302e601 100644 --- a/indra/llmessage/debug_libcurl.cpp +++ b/indra/llmessage/debug_libcurl.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "llpreprocessor.h" #include #define COMPILING_DEBUG_LIBCURL_CC @@ -528,19 +529,66 @@ std::ostream& operator<<(std::ostream& os, EvBitmask const& bitmask) return os; } +// Set this to limit the curl debug output to specific easy handles. +bool gDebugCurlTerse = false; + +namespace { + +std::vector handles; + +inline bool print_debug(CURL* handle) +{ + if (!gDebugCurlTerse) + return true; + return std::find(handles.begin(), handles.end(), handle) != handles.end(); +} + +} // namespace + +void debug_curl_add_easy(CURL* handle) +{ + std::vector::iterator iter = std::find(handles.begin(), handles.end(), handle); + if (iter == handles.end()) + { + handles.push_back(handle); + Dout(dc::warning, "debug_curl_add_easy(" << (void*)handle << "): added"); + } + llassert(print_debug(handle)); +} + +void debug_curl_remove_easy(CURL* handle) +{ + std::vector::iterator iter = std::find(handles.begin(), handles.end(), handle); + if (iter != handles.end()) + { + handles.erase(iter); + Dout(dc::warning, "debug_curl_remove_easy(" << (void*)handle << "): removed"); + } + llassert(!print_debug(handle)); +} + +bool debug_curl_print_debug(CURL* handle) +{ + return print_debug(handle); +} + extern "C" { void debug_curl_easy_cleanup(CURL* handle) { curl_easy_cleanup(handle); - Dout(dc::curl, "curl_easy_cleanup(" << (AICURL*)handle << ")"); + if (print_debug(handle)) + { + Dout(dc::curltr, "curl_easy_cleanup(" << (AICURL*)handle << ")"); + } } CURL* debug_curl_easy_duphandle(CURL* handle) { CURL* ret; ret = curl_easy_duphandle(handle); - Dout(dc::curl, "curl_easy_duphandle(" << (AICURL*)handle << ") = " << (AICURL*)ret); + if (!print_debug(handle)) return ret; + Dout(dc::curltr, "curl_easy_duphandle(" << (AICURL*)handle << ") = " << (AICURL*)ret); return ret; } @@ -548,11 +596,12 @@ char* debug_curl_easy_escape(CURL* curl, char* url, int length) { char* ret; ret = curl_easy_escape(curl, url, length); - Dout(dc::curl, "curl_easy_escape(" << (AICURL*)curl << ", \"" << url << "\", " << length << ") = \"" << ret << '"'); + if (!print_debug(curl)) return ret; + Dout(dc::curltr, "curl_easy_escape(" << (AICURL*)curl << ", \"" << url << "\", " << length << ") = \"" << ret << '"'); return ret; } -CURLcode debug_curl_easy_getinfo(CURL* curl, CURLINFO info, ...) +CURLcode debug_curl_easy_getinfo(CURL* handle, CURLINFO info, ...) { CURLcode ret; va_list ap; @@ -566,26 +615,27 @@ CURLcode debug_curl_easy_getinfo(CURL* curl, CURLINFO info, ...) va_start(ap, info); param.some_ptr = va_arg(ap, void*); va_end(ap); - ret = curl_easy_getinfo(curl, info, param.some_ptr); + ret = curl_easy_getinfo(handle, info, param.some_ptr); + if (!print_debug(handle)) return ret; if (info == CURLINFO_PRIVATE) { - Dout(dc::curl, "curl_easy_getinfo(" << (AICURL*)curl << ", " << info << ", 0x" << std::hex << (size_t)param.some_ptr << std::dec << ") = " << ret); + Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", 0x" << std::hex << (size_t)param.some_ptr << std::dec << ") = " << ret); } else { switch((info & CURLINFO_TYPEMASK)) { case CURLINFO_STRING: - Dout(dc::curl, "curl_easy_getinfo(" << (AICURL*)curl << ", " << info << ", (char**){ \"" << (ret == CURLE_OK ? *param.char_ptr : " ") << "\" }) = " << ret); + Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (char**){ \"" << (ret == CURLE_OK ? *param.char_ptr : " ") << "\" }) = " << ret); break; case CURLINFO_LONG: - Dout(dc::curl, "curl_easy_getinfo(" << (AICURL*)curl << ", " << info << ", (long*){ " << (ret == CURLE_OK ? *param.long_ptr : 0L) << "L }) = " << ret); + Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (long*){ " << (ret == CURLE_OK ? *param.long_ptr : 0L) << "L }) = " << ret); break; case CURLINFO_DOUBLE: - Dout(dc::curl, "curl_easy_getinfo(" << (AICURL*)curl << ", " << info << ", (double*){" << (ret == CURLE_OK ? *param.double_ptr : 0.) << "}) = " << ret); + Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (double*){" << (ret == CURLE_OK ? *param.double_ptr : 0.) << "}) = " << ret); break; case CURLINFO_SLIST: - Dout(dc::curl, "curl_easy_getinfo(" << (AICURL*)curl << ", " << info << ", (curl_slist**){ " << (ret == CURLE_OK ? **param.curl_slist_ptr : unchanged_slist) << " }) = " << ret); + Dout(dc::curltr, "curl_easy_getinfo(" << (AICURL*)handle << ", " << info << ", (curl_slist**){ " << (ret == CURLE_OK ? **param.curl_slist_ptr : unchanged_slist) << " }) = " << ret); break; } } @@ -596,7 +646,8 @@ CURL* debug_curl_easy_init(void) { CURL* ret; ret = curl_easy_init(); - Dout(dc::curl, "curl_easy_init() = " << (AICURL*)ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_easy_init() = " << (AICURL*)ret); return ret; } @@ -604,7 +655,8 @@ CURLcode debug_curl_easy_pause(CURL* handle, int bitmask) { CURLcode ret; ret = curl_easy_pause(handle, bitmask); - Dout(dc::curl, "curl_easy_pause(" << (AICURL*)handle << ", 0x" << std::hex << bitmask << std::dec << ") = " << ret); + if (!print_debug(handle)) return ret; + Dout(dc::curltr, "curl_easy_pause(" << (AICURL*)handle << ", 0x" << std::hex << bitmask << std::dec << ") = " << ret); return ret; } @@ -612,14 +664,16 @@ CURLcode debug_curl_easy_perform(CURL* handle) { CURLcode ret; ret = curl_easy_perform(handle); - Dout(dc::curl, "curl_easy_perform(" << (AICURL*)handle << ") = " << ret); + if (!print_debug(handle)) return ret; + Dout(dc::curltr, "curl_easy_perform(" << (AICURL*)handle << ") = " << ret); return ret; } void debug_curl_easy_reset(CURL* handle) { curl_easy_reset(handle); - Dout(dc::curl, "curl_easy_reset(" << (AICURL*)handle << ")"); + if (!print_debug(handle)) return; + Dout(dc::curltr, "curl_easy_reset(" << (AICURL*)handle << ")"); } CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) @@ -656,7 +710,10 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) case CURLOPTTYPE_LONG: { ret = curl_easy_setopt(handle, option, param.along); - Dout(dc::curl, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", " << param.along << "L) = " << ret); + if (print_debug(handle)) + { + Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", " << param.along << "L) = " << ret); + } if (option == CURLOPT_POSTFIELDSIZE) { postfieldsize = param.along; @@ -666,7 +723,8 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) case CURLOPTTYPE_OBJECTPOINT: { ret = curl_easy_setopt(handle, option, param.ptr); - LibcwDoutScopeBegin(LIBCWD_DEBUGCHANNELS, libcwd::libcw_do, dc::curl) + if (!print_debug(handle)) break; + LibcwDoutScopeBegin(LIBCWD_DEBUGCHANNELS, libcwd::libcw_do, dc::curltr) LibcwDoutStream << "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", "; // For a subset of all options that take a char*, print the string passed. if (option == CURLOPT_PROXY || // Set HTTP proxy to use. The parameter should be a char* to a zero terminated string holding the host name or dotted IP address. @@ -717,11 +775,11 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) if (option == CURLOPT_HTTPHEADER && param.ptr) { debug::Indent indent(2); - Dout(dc::curl, "HTTP Headers:"); + Dout(dc::curltr, "HTTP Headers:"); struct curl_slist* list = (struct curl_slist*)param.ptr; while (list) { - Dout(dc::curl, '"' << list->data << '"'); + Dout(dc::curltr, '"' << list->data << '"'); list = list->next; } } @@ -729,12 +787,18 @@ CURLcode debug_curl_easy_setopt(CURL* handle, CURLoption option, ...) } case CURLOPTTYPE_FUNCTIONPOINT: ret = curl_easy_setopt(handle, option, param.ptr); - Dout(dc::curl, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); + if (print_debug(handle)) + { + Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); + } break; case CURLOPTTYPE_OFF_T: { ret = curl_easy_setopt(handle, option, param.offset); - Dout(dc::curl, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret); + if (print_debug(handle)) + { + Dout(dc::curltr, "curl_easy_setopt(" << (AICURL*)handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret); + } if (option == CURLOPT_POSTFIELDSIZE_LARGE) { postfieldsize = (long)param.offset; @@ -751,7 +815,8 @@ char const* debug_curl_easy_strerror(CURLcode errornum) { char const* ret; ret = curl_easy_strerror(errornum); - Dout(dc::curl, "curl_easy_strerror(" << errornum << ") = \"" << ret << '"'); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_easy_strerror(" << errornum << ") = \"" << ret << '"'); return ret; } @@ -759,35 +824,38 @@ char* debug_curl_easy_unescape(CURL* curl, char* url, int inlength, int* outleng { char* ret; ret = curl_easy_unescape(curl, url, inlength, outlength); - Dout(dc::curl, "curl_easy_unescape(" << (AICURL*)curl << ", \"" << url << "\", " << inlength << ", " << ((ret && outlength) ? *outlength : 1) << ") = \"" << ret << '"'); + if (!print_debug(curl)) return ret; + Dout(dc::curltr, "curl_easy_unescape(" << (AICURL*)curl << ", \"" << url << "\", " << inlength << ", " << ((ret && outlength) ? *outlength : 1) << ") = \"" << ret << '"'); return ret; } void debug_curl_free(char* ptr) { curl_free(ptr); - Dout(dc::curl, "curl_free(0x" << std::hex << (size_t)ptr << std::dec << ")"); + if (gDebugCurlTerse) return; + Dout(dc::curltr, "curl_free(0x" << std::hex << (size_t)ptr << std::dec << ")"); } time_t debug_curl_getdate(char const* datestring, time_t* now) { time_t ret; ret = curl_getdate(datestring, now); - Dout(dc::curl, "curl_getdate(\"" << datestring << "\", " << (now == NULL ? "NULL" : "") << ") = " << ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_getdate(\"" << datestring << "\", " << (now == NULL ? "NULL" : "") << ") = " << ret); return ret; } void debug_curl_global_cleanup(void) { curl_global_cleanup(); - Dout(dc::curl, "curl_global_cleanup()"); + Dout(dc::curltr, "curl_global_cleanup()"); } CURLcode debug_curl_global_init(long flags) { CURLcode ret; ret = curl_global_init(flags); - Dout(dc::curl, "curl_global_init(0x" << std::hex << flags << std::dec << ") = " << ret); + Dout(dc::curltr, "curl_global_init(0x" << std::hex << flags << std::dec << ") = " << ret); return ret; } @@ -795,7 +863,8 @@ CURLMcode debug_curl_multi_add_handle(CURLM* multi_handle, CURL* easy_handle) { CURLMcode ret; ret = curl_multi_add_handle(multi_handle, easy_handle); - Dout(dc::curl, "curl_multi_add_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_add_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret); return ret; } @@ -803,7 +872,8 @@ CURLMcode debug_curl_multi_assign(CURLM* multi_handle, curl_socket_t sockfd, voi { CURLMcode ret; ret = curl_multi_assign(multi_handle, sockfd, sockptr); - Dout(dc::curl, "curl_multi_assign(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << sockptr << ") = " << ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_assign(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << sockptr << ") = " << ret); return ret; } @@ -811,7 +881,8 @@ CURLMcode debug_curl_multi_cleanup(CURLM* multi_handle) { CURLMcode ret; ret = curl_multi_cleanup(multi_handle); - Dout(dc::curl, "curl_multi_cleanup(" << (AICURLM*)multi_handle << ") = " << ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_cleanup(" << (AICURLM*)multi_handle << ") = " << ret); return ret; } @@ -819,7 +890,8 @@ CURLMsg* debug_curl_multi_info_read(CURLM* multi_handle, int* msgs_in_queue) { CURLMsg* ret; ret = curl_multi_info_read(multi_handle, msgs_in_queue); - Dout(dc::curl, "curl_multi_info_read(" << (AICURLM*)multi_handle << ", {" << *msgs_in_queue << "}) = " << ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_info_read(" << (AICURLM*)multi_handle << ", {" << *msgs_in_queue << "}) = " << ret); return ret; } @@ -827,7 +899,8 @@ CURLM* debug_curl_multi_init(void) { CURLM* ret; ret = curl_multi_init(); - Dout(dc::curl, "curl_multi_init() = " << (AICURLM*)ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_init() = " << (AICURLM*)ret); return ret; } @@ -835,7 +908,8 @@ CURLMcode debug_curl_multi_remove_handle(CURLM* multi_handle, CURL* easy_handle) { CURLMcode ret; ret = curl_multi_remove_handle(multi_handle, easy_handle); - Dout(dc::curl, "curl_multi_remove_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret); + if (!print_debug(easy_handle)) return ret; + Dout(dc::curltr, "curl_multi_remove_handle(" << (AICURLM*)multi_handle << ", " << (AICURL*)easy_handle << ") = " << ret); return ret; } @@ -871,19 +945,23 @@ CURLMcode debug_curl_multi_setopt(CURLM* multi_handle, CURLMoption option, ...) { case CURLOPTTYPE_LONG: ret = curl_multi_setopt(multi_handle, option, param.along); - Dout(dc::curl, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", " << param.along << "L) = " << ret); + if (gDebugCurlTerse) break; + Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", " << param.along << "L) = " << ret); break; case CURLOPTTYPE_OBJECTPOINT: ret = curl_multi_setopt(multi_handle, option, param.ptr); - Dout(dc::curl, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (object*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); + if (gDebugCurlTerse) break; + Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (object*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); break; case CURLOPTTYPE_FUNCTIONPOINT: ret = curl_multi_setopt(multi_handle, option, param.ptr); - Dout(dc::curl, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); + if (gDebugCurlTerse) break; + Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (function*)0x" << std::hex << (size_t)param.ptr << std::dec << ") = " << ret); break; case CURLOPTTYPE_OFF_T: ret = curl_multi_setopt(multi_handle, option, param.offset); - Dout(dc::curl, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret); + if (gDebugCurlTerse) break; + Dout(dc::curltr, "curl_easy_setopt(" << (AICURLM*)multi_handle << ", " << option << ", (curl_off_t)" << param.offset << ") = " << ret); break; default: // Stop compiler complaining about no default. break; @@ -895,7 +973,8 @@ CURLMcode debug_curl_multi_socket_action(CURLM* multi_handle, curl_socket_t sock { CURLMcode ret; ret = curl_multi_socket_action(multi_handle, sockfd, ev_bitmask, running_handles); - Dout(dc::curl, "curl_multi_socket_action(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_socket_action(" << (AICURLM*)multi_handle << ", " << Socket(sockfd) << ", " << EvBitmask(ev_bitmask) << ", {" << (ret == CURLM_OK ? *running_handles : 0) << "}) = " << ret); return ret; } @@ -904,7 +983,8 @@ char const* debug_curl_multi_strerror(CURLMcode errornum) { char const* ret; ret = curl_multi_strerror(errornum); - Dout(dc::curl, "curl_multi_strerror(" << errornum << ") = \"" << ret << '"'); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_multi_strerror(" << errornum << ") = \"" << ret << '"'); return ret; } @@ -912,21 +992,24 @@ struct curl_slist* debug_curl_slist_append(struct curl_slist* list, char const* { struct curl_slist* ret; ret = curl_slist_append(list, string); - Dout(dc::curl, "curl_slist_append((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ", \"" << string << "\") = " << *ret); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_slist_append((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ", \"" << string << "\") = " << *ret); return ret; } void debug_curl_slist_free_all(struct curl_slist* list) { curl_slist_free_all(list); - Dout(dc::curl, "curl_slist_free_all((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ")"); + if (gDebugCurlTerse) return; + Dout(dc::curltr, "curl_slist_free_all((curl_slist)@0x" << std::hex << (size_t)list << std::dec << ")"); } char* debug_curl_unescape(char const* url, int length) { char* ret; ret = curl_unescape(url, length); - Dout(dc::curl, "curl_unescape(\"" << url << "\", " << length << ") = \"" << ret << '"'); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_unescape(\"" << url << "\", " << length << ") = \"" << ret << '"'); return ret; } @@ -934,7 +1017,8 @@ char* debug_curl_version(void) { char* ret; ret = curl_version(); - Dout(dc::curl, "curl_version() = \"" << ret << '"'); + if (gDebugCurlTerse) return ret; + Dout(dc::curltr, "curl_version() = \"" << ret << '"'); return ret; } diff --git a/indra/llmessage/debug_libcurl.h b/indra/llmessage/debug_libcurl.h index 27becb1c6..49105aa1d 100644 --- a/indra/llmessage/debug_libcurl.h +++ b/indra/llmessage/debug_libcurl.h @@ -86,4 +86,9 @@ extern char* debug_curl_version(void); #endif // !COMPILING_DEBUG_LIBCURL_CC +extern bool gDebugCurlTerse; // With this set, +void debug_curl_add_easy(CURL* handle); // only output debug output for easy handles added with this function. +void debug_curl_remove_easy(CURL* handle); +bool debug_curl_print_debug(CURL* handle); + #endif // DEBUG_LIBCURL diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index d72a6e646..50c6a17e5 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -200,7 +200,8 @@ static void request( LLURLRequest::ERequestAction method, Injector* body_injector, LLHTTPClient::ResponderPtr responder, - AIHTTPHeaders& headers, + AIHTTPHeaders& headers/*,*/ + DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive = keep_alive, bool is_auth = false, bool no_compression = false) @@ -215,6 +216,9 @@ static void request( try { req = new LLURLRequest(method, url, body_injector, responder, headers, keepalive, is_auth, no_compression); +#ifdef DEBUG_CURLIO + req->mCurlEasyRequest.debug(debug); +#endif } catch(AICurlNoEasyHandle& error) { @@ -226,36 +230,36 @@ static void request( req->run(); } -void LLHTTPClient::getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { if(offset > 0 || bytes > 0) { headers.addHeader("Range", llformat("bytes=%d-%d", offset, offset + bytes - 1)); } - request(url, LLURLRequest::HTTP_GET, NULL, responder, headers); + request(url, LLURLRequest::HTTP_GET, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } -void LLHTTPClient::head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers) +void LLHTTPClient::head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } -void LLHTTPClient::get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, headers); + request(url, LLURLRequest::HTTP_GET, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } -void LLHTTPClient::getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers) +void LLHTTPClient::getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } -void LLHTTPClient::get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { LLURI uri; uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); - get(uri.asString(), responder, headers); + get(uri.asString(), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } //============================================================================= @@ -555,7 +559,8 @@ enum EBlockingRequestAction { static LLSD blocking_request( std::string const& url, EBlockingRequestAction method, - LLSD const& body) // Only used for HTTP_LLSD_POST + LLSD const& body/*,*/ // Only used for HTTP_LLSD_POST + DEBUG_CURLIO_PARAM(EDebugCurl debug)) { lldebugs << "blockingRequest of " << url << llendl; @@ -564,17 +569,17 @@ static LLSD blocking_request( if (method == HTTP_LLSD_POST) { responder = new BlockingLLSDPostResponder; - LLHTTPClient::post(url, body, responder, headers); + LLHTTPClient::post(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } else if (method == HTTP_LLSD_GET) { responder = new BlockingLLSDGetResponder; - LLHTTPClient::get(url, responder, headers); + LLHTTPClient::get(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } else // method == HTTP_RAW_GET { responder = new BlockingRawGetResponder; - LLHTTPClient::get(url, responder, headers); + LLHTTPClient::get(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } responder->wait(); @@ -636,39 +641,39 @@ static LLSD blocking_request( return response; } -LLSD LLHTTPClient::blockingPost(const std::string& url, const LLSD& body) +LLSD LLHTTPClient::blockingPost(const std::string& url, const LLSD& body/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - return blocking_request(url, HTTP_LLSD_POST, body); + return blocking_request(url, HTTP_LLSD_POST, body/*,*/ DEBUG_CURLIO_PARAM(debug)); } -LLSD LLHTTPClient::blockingGet(const std::string& url) +LLSD LLHTTPClient::blockingGet(const std::string& url/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - return blocking_request(url, HTTP_LLSD_GET, LLSD()); + return blocking_request(url, HTTP_LLSD_GET, LLSD()/*,*/ DEBUG_CURLIO_PARAM(debug)); } -U32 LLHTTPClient::blockingGetRaw(const std::string& url, std::string& body) +U32 LLHTTPClient::blockingGetRaw(const std::string& url, std::string& body/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - LLSD result = blocking_request(url, HTTP_RAW_GET, LLSD()); + LLSD result = blocking_request(url, HTTP_RAW_GET, LLSD()/*,*/ DEBUG_CURLIO_PARAM(debug)); body = result["body"].asString(); return result["status"].asInteger(); } -void LLHTTPClient::put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, headers); + request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } -void LLHTTPClient::post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { - request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, headers, keepalive); + request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } -void LLHTTPClient::postXMLRPC(std::string const& url, XMLRPC_REQUEST xmlrpc_request, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::postXMLRPC(std::string const& url, XMLRPC_REQUEST xmlrpc_request, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { - request(url, LLURLRequest::HTTP_POST, new XMLRPCInjector(xmlrpc_request), responder, headers, keepalive, true, false); // Does use compression. + request(url, LLURLRequest::HTTP_POST, new XMLRPCInjector(xmlrpc_request), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, true, false); // Does use compression. } -void LLHTTPClient::postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { XMLRPC_REQUEST xmlrpc_request = XMLRPC_RequestNew(); XMLRPC_RequestSetMethodName(xmlrpc_request, method); @@ -676,33 +681,33 @@ void LLHTTPClient::postXMLRPC(std::string const& url, char const* method, XMLRPC XMLRPC_RequestSetData(xmlrpc_request, value); // XMLRPCInjector takes ownership of xmlrpc_request and will free it when done. // LLURLRequest takes ownership of the XMLRPCInjector object and will free it when done. - request(url, LLURLRequest::HTTP_POST, new XMLRPCInjector(xmlrpc_request), responder, headers, keepalive, true, true); // Does not use compression. + request(url, LLURLRequest::HTTP_POST, new XMLRPCInjector(xmlrpc_request), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, true, true); // Does not use compression. } -void LLHTTPClient::postRaw(std::string const& url, char const* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::postRaw(std::string const& url, char const* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { - request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, headers, keepalive); + request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } -void LLHTTPClient::postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { - request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, headers, keepalive); + request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } -void LLHTTPClient::postFile(std::string const& url, LLUUID const& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive) +void LLHTTPClient::postFile(std::string const& url, LLUUID const& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive) { - request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, headers, keepalive); + request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } // static -void LLHTTPClient::del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { - request(url, LLURLRequest::HTTP_DELETE, NULL, responder, headers); + request(url, LLURLRequest::HTTP_DELETE, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } // static -void LLHTTPClient::move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers) +void LLHTTPClient::move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) { headers.addHeader("Destination", destination); - request(url, LLURLRequest::HTTP_MOVE, NULL, responder, headers); + request(url, LLURLRequest::HTTP_MOVE, NULL, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 8a3eba2b5..70614cc84 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -71,6 +71,16 @@ enum EKeepAlive { keep_alive }; +#ifdef DEBUG_CURLIO +enum EDebugCurl { + debug_off = 0, + debug_on +}; +#define DEBUG_CURLIO_PARAM(p) ,p +#else +#define DEBUG_CURLIO_PARAM(p) +#endif + class LLHTTPClient { public: @@ -366,59 +376,59 @@ public: /** @name non-blocking API */ //@{ - static void head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers); - static void head(std::string const& url, ResponderHeadersOnly* responder) - { AIHTTPHeaders headers; head(url, responder, headers); } + static void head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void head(std::string const& url, ResponderHeadersOnly* responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; head(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers); - static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder) - { AIHTTPHeaders headers; getByteRange(url, offset, bytes, responder, headers); } + static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; getByteRange(url, offset, bytes, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers); - static void get(std::string const& url, ResponderPtr responder) - { AIHTTPHeaders headers; get(url, responder, headers); } + static void get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void get(std::string const& url, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; get(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers); - static void get(std::string const& url, LLSD const& query, ResponderPtr responder) - { AIHTTPHeaders headers; get(url, query, responder, headers); } + static void get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void get(std::string const& url, LLSD const& query, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; get(url, query, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers); - static void put(std::string const& url, LLSD const& body, ResponderPtr responder) - { AIHTTPHeaders headers; put(url, body, responder, headers); } + static void put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void put(std::string const& url, LLSD const& body, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; put(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers); - static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder) - { AIHTTPHeaders headers; getHeaderOnly(url, responder, headers); } + static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; getHeaderOnly(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } - static void post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void post(std::string const& url, LLSD const& body, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; post(url, body, responder, headers, keepalive); } + static void post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void post(std::string const& url, LLSD const& body, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; post(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } /** Takes ownership of request and deletes it when sent */ - static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; postXMLRPC(url, request, responder, headers, keepalive); } + static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; postXMLRPC(url, request, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } - static void postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; postXMLRPC(url, method, value, responder, headers, keepalive); } + static void postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void postXMLRPC(std::string const& url, char const* method, XMLRPC_VALUE value, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; postXMLRPC(url, method, value, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } /** Takes ownership of data and deletes it when sent */ - static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; postRaw(url, data, size, responder, headers, keepalive); } + static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; postRaw(url, data, size, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } - static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; postFile(url, filename, responder, headers, keepalive); } + static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; postFile(url, filename, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } - static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers, EKeepAlive keepalive = keep_alive); - static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, EKeepAlive keepalive = keep_alive) - { AIHTTPHeaders headers; postFile(url, uuid, asset_type, responder, headers, keepalive); } + static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive); + static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive) + { AIHTTPHeaders headers; postFile(url, uuid, asset_type, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive); } - static void del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers); - static void del(std::string const& url, ResponderPtr responder) - { AIHTTPHeaders headers; del(url, responder, headers); } + static void del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void del(std::string const& url, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; del(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } ///< sends a DELETE method, but we can't call it delete in c++ @@ -431,9 +441,9 @@ public: * @param headers A map of key:value headers to pass to the request * @param timeout The number of seconds to give the server to respond. */ - static void move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers); - static void move(std::string const& url, std::string const& destination, ResponderPtr responder) - { AIHTTPHeaders headers; move(url, destination, responder, headers); } + static void move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void move(std::string const& url, std::string const& destination, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; move(url, destination, responder, headers, debug); } //@} @@ -443,7 +453,7 @@ public: * @param url the complete serialized (and escaped) url to get * @return An LLSD of { 'status':status, 'body':payload } */ - static LLSD blockingGet(std::string const& url); + static LLSD blockingGet(std::string const& url/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); /** * @brief Blocking HTTP GET that returns the raw body. @@ -452,7 +462,7 @@ public: * @param result the target string to write the body to * @return HTTP status */ - static U32 blockingGetRaw(const std::string& url, std::string& result); + static U32 blockingGetRaw(const std::string& url, std::string& result/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); /** * @brief Blocking HTTP POST that returns an LLSD map of status and body. @@ -461,7 +471,7 @@ public: * @param body the LLSD post body * @return An LLSD of { 'status':status (an int), 'body':payload (an LLSD) } */ - static LLSD blockingPost(std::string const& url, LLSD const& body); + static LLSD blockingPost(std::string const& url, LLSD const& body/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); }; #endif // LL_LLHTTPCLIENT_H diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4f5a15620..7eebd0f6f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6490,6 +6490,22 @@ This should be as low as possible, but too low may break functionality 0 + FloaterOutboxRect + + Comment + Rectangle for merchant outbox window + Persist + 1 + Type + Rect + Value + + 0 + 342 + 310 + 52 + + FloaterPayRectB Comment diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 3cb77c432..df2bf5322 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -227,7 +227,7 @@ namespace LLMarketplaceImport { if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout" << llendl; + llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout (" << status << " / " << reason << ")." << llendl; } sMarketplaceCookie.clear(); @@ -373,7 +373,7 @@ namespace LLMarketplaceImport // Interface class // -//static const F32 MARKET_IMPORTER_UPDATE_FREQUENCY = 300.0f; //1.0f; +static const F32 MARKET_IMPORTER_UPDATE_FREQUENCY = 1.0f; //static void LLMarketplaceInventoryImporter::update() @@ -384,7 +384,7 @@ void LLMarketplaceInventoryImporter::update() if (update_timer.hasExpired()) { LLMarketplaceInventoryImporter::instance().updateImport(); - static LLCachedControl MARKET_IMPORTER_UPDATE_FREQUENCY("MarketImporterUpdateFreq", 10.0f); + //static LLCachedControl MARKET_IMPORTER_UPDATE_FREQUENCY("MarketImporterUpdateFreq", 1.0f); update_timer.setTimerExpirySec(MARKET_IMPORTER_UPDATE_FREQUENCY); } } diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index cc605e40e..992307160 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -306,7 +306,7 @@ void LLWebProfile::post(LLPointer image, const LLSD& config, c memcpy(data + body_size + image->getDataSize(), footer.str().data(), footer_size); // Send request, successful upload will trigger posting metadata. - LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(), headers, no_keep_alive); + LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(), headers/*,*/ DEBUG_CURLIO_PARAM(debug_off), no_keep_alive); } // static diff --git a/indra/newview/skins/default/xui/en-us/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/en-us/floater_merchant_outbox.xml index e6ff5213b..62d84d7c0 100644 --- a/indra/newview/skins/default/xui/en-us/floater_merchant_outbox.xml +++ b/indra/newview/skins/default/xui/en-us/floater_merchant_outbox.xml @@ -10,6 +10,7 @@ name="floater_merchant_outbox" save_rect="true" save_visibility="false" + rect_control="FloaterOutboxRect" reuse_instance="true" title="Merchant Outbox" width="333">