From 0353498b9ccf214926ee8358c293823e9ae0a9db Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Mon, 1 Jul 2013 15:44:47 +0200 Subject: [PATCH] Set CURLOPT_FORBID_REUSE for XMLRPCResponder XMLRPCResponder is used to login, which is a HTTP 1.0 server that doesn't support reuse of connections. It's cleaner to close connections from our side too. This changes, 0x7fffdcf93700 CURLIO 0x7fffcd86db40 * Connection #0 to host login.agni.lindenlab.com left intact into 0x7fffdcf93700 CURLIO 0x7fffcd8b0bd0 * Closing connection #0 --- indra/llmessage/aicurl.cpp | 4 ++++ indra/llmessage/llhttpclient.h | 4 ++++ indra/newview/llxmlrpcresponder.h | 1 + 3 files changed, 9 insertions(+) diff --git a/indra/llmessage/aicurl.cpp b/indra/llmessage/aicurl.cpp index e5dcb6ae8..7e6fc9236 100644 --- a/indra/llmessage/aicurl.cpp +++ b/indra/llmessage/aicurl.cpp @@ -1392,6 +1392,10 @@ void BufferedCurlEasyRequest::prepRequest(AICurlEasyRequest_wat& curl_easy_reque // to id.secondlife.com for marketplace.secondlife.com. allow_cookies = true; } + if (responder->forbidReuse()) + { + curl_easy_request_w->setopt(CURLOPT_FORBID_REUSE, 1); + } if (allow_cookies) { // Given an empty or non-existing file or by passing the empty string (""), diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index af11a6687..b4ce6facc 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -217,6 +217,10 @@ public: // Derived classes that implement completed_headers()/completedHeaders() should return true here. virtual bool needsHeaders(void) const { return false; } + // A derived class should return true if curl should close the connection when done. + // The default is to keep connections open for possible reuse. + virtual bool forbidReuse(void) const { return false; } + // A derived class should return true if curl should follow redirections. // The default is not to follow redirections. virtual bool followRedir(void) const { return false; } diff --git a/indra/newview/llxmlrpcresponder.h b/indra/newview/llxmlrpcresponder.h index 3c32cd2a6..4a5f29077 100644 --- a/indra/newview/llxmlrpcresponder.h +++ b/indra/newview/llxmlrpcresponder.h @@ -107,6 +107,7 @@ public: LLXMLRPCValue responseValue(void) const; /*virtual*/ bool needsHeaders(void) const { return true; } + /*virtual*/ bool forbidReuse(void) const { return true; } /*virtual*/ void received_HTTP_header(void) { mReceivedHTTPHeader = true; LLHTTPClient::ResponderBase::received_HTTP_header(); } /*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info); /*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);