diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llmessage/llcurl.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmessage/llcurl.cpp | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp index f03cebc..834ec4b 100644 --- a/linden/indra/llmessage/llcurl.cpp +++ b/linden/indra/llmessage/llcurl.cpp | |||
@@ -101,6 +101,12 @@ void LLCurl::setCAFile(const std::string& file) | |||
101 | sCAFile = file; | 101 | sCAFile = file; |
102 | } | 102 | } |
103 | 103 | ||
104 | //static | ||
105 | std::string LLCurl::getVersionString() | ||
106 | { | ||
107 | return std::string(curl_version()); | ||
108 | } | ||
109 | |||
104 | ////////////////////////////////////////////////////////////////////////////// | 110 | ////////////////////////////////////////////////////////////////////////////// |
105 | 111 | ||
106 | LLCurl::Responder::Responder() | 112 | LLCurl::Responder::Responder() |
@@ -113,6 +119,15 @@ LLCurl::Responder::~Responder() | |||
113 | } | 119 | } |
114 | 120 | ||
115 | // virtual | 121 | // virtual |
122 | void LLCurl::Responder::error( | ||
123 | U32 status, | ||
124 | const std::string& reason, | ||
125 | const LLSD&) | ||
126 | { | ||
127 | error(status, reason); | ||
128 | } | ||
129 | |||
130 | // virtual | ||
116 | void LLCurl::Responder::error(U32 status, const std::string& reason) | 131 | void LLCurl::Responder::error(U32 status, const std::string& reason) |
117 | { | 132 | { |
118 | llinfos << status << ": " << reason << llendl; | 133 | llinfos << status << ": " << reason << llendl; |
@@ -124,38 +139,16 @@ void LLCurl::Responder::result(const LLSD& content) | |||
124 | } | 139 | } |
125 | 140 | ||
126 | // virtual | 141 | // virtual |
127 | void LLCurl::Responder::completedRaw(U32 status, const std::string& reason, | 142 | void LLCurl::Responder::completedRaw( |
128 | const LLChannelDescriptors& channels, | 143 | U32 status, |
129 | const LLIOPipe::buffer_ptr_t& buffer) | 144 | const std::string& reason, |
145 | const LLChannelDescriptors& channels, | ||
146 | const LLIOPipe::buffer_ptr_t& buffer) | ||
130 | { | 147 | { |
131 | if (isGoodStatus(status)) | 148 | LLSD content; |
132 | { | 149 | LLBufferStream istr(channels, buffer.get()); |
133 | LLSD content; | 150 | LLSDSerialize::fromXML(content, istr); |
134 | LLBufferStream istr(channels, buffer.get()); | 151 | completed(status, reason, content); |
135 | LLSDSerialize::fromXML(content, istr); | ||
136 | /* | ||
137 | const S32 parseError = -1; | ||
138 | if(LLSDSerialize::fromXML(content, istr) == parseError) | ||
139 | { | ||
140 | mStatus = 498; | ||
141 | mReason = "Client Parse Error"; | ||
142 | } | ||
143 | */ | ||
144 | completed(status, reason, content); | ||
145 | } | ||
146 | else if (status == 400) | ||
147 | { | ||
148 | // Get reason from buffer | ||
149 | char tbuf[4096]; | ||
150 | S32 len = 4096; | ||
151 | buffer->readAfter(channels.in(), NULL, (U8*)tbuf, len); | ||
152 | tbuf[len] = 0; | ||
153 | completed(status, std::string(tbuf), LLSD()); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | completed(status, reason, LLSD()); | ||
158 | } | ||
159 | } | 152 | } |
160 | 153 | ||
161 | // virtual | 154 | // virtual |
@@ -167,7 +160,7 @@ void LLCurl::Responder::completed(U32 status, const std::string& reason, const L | |||
167 | } | 160 | } |
168 | else | 161 | else |
169 | { | 162 | { |
170 | error(status, reason); | 163 | error(status, reason, content); |
171 | } | 164 | } |
172 | } | 165 | } |
173 | 166 | ||
@@ -281,7 +274,7 @@ LLCurl::Easy::~Easy() | |||
281 | curl_easy_cleanup(mCurlEasyHandle); | 274 | curl_easy_cleanup(mCurlEasyHandle); |
282 | --gCurlEasyCount; | 275 | --gCurlEasyCount; |
283 | curl_slist_free_all(mHeaders); | 276 | curl_slist_free_all(mHeaders); |
284 | for_each(mStrings.begin(), mStrings.end(), DeletePointer()); | 277 | for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); |
285 | } | 278 | } |
286 | 279 | ||
287 | void LLCurl::Easy::resetState() | 280 | void LLCurl::Easy::resetState() |
@@ -882,6 +875,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url) | |||
882 | { | 875 | { |
883 | llassert_always(!mRequestSent); | 876 | llassert_always(!mRequestSent); |
884 | mRequestSent = true; | 877 | mRequestSent = true; |
878 | lldebugs << url << llendl; | ||
885 | if (mEasy) | 879 | if (mEasy) |
886 | { | 880 | { |
887 | mEasy->setHeaders(); | 881 | mEasy->setHeaders(); |