diff options
Diffstat (limited to 'linden/indra/llmessage/llhttpclient.cpp')
-rw-r--r-- | linden/indra/llmessage/llhttpclient.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp index 8cb8344..a1f8e29 100644 --- a/linden/indra/llmessage/llhttpclient.cpp +++ b/linden/indra/llmessage/llhttpclient.cpp | |||
@@ -70,6 +70,29 @@ void LLHTTPClient::Responder::result(const LLSD& content) | |||
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | // virtual | ||
74 | void LLHTTPClient::Responder::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, | ||
75 | const LLIOPipe::buffer_ptr_t& buffer) | ||
76 | { | ||
77 | LLBufferStream istr(channels, buffer.get()); | ||
78 | LLSD content; | ||
79 | |||
80 | if (200 <= status && status < 300) | ||
81 | { | ||
82 | LLSDSerialize::fromXML(content, istr); | ||
83 | /* | ||
84 | const S32 parseError = -1; | ||
85 | if(LLSDSerialize::fromXML(content, istr) == parseError) | ||
86 | { | ||
87 | mStatus = 498; | ||
88 | mReason = "Client Parse Error"; | ||
89 | } | ||
90 | */ | ||
91 | } | ||
92 | |||
93 | completed(status, reason, content); | ||
94 | } | ||
95 | |||
73 | // virtual | 96 | // virtual |
74 | void LLHTTPClient::Responder::completed(U32 status, const std::string& reason, const LLSD& content) | 97 | void LLHTTPClient::Responder::completed(U32 status, const std::string& reason, const LLSD& content) |
75 | { | 98 | { |
@@ -108,25 +131,9 @@ namespace | |||
108 | virtual void complete(const LLChannelDescriptors& channels, | 131 | virtual void complete(const LLChannelDescriptors& channels, |
109 | const buffer_ptr_t& buffer) | 132 | const buffer_ptr_t& buffer) |
110 | { | 133 | { |
111 | LLBufferStream istr(channels, buffer.get()); | ||
112 | LLSD content; | ||
113 | |||
114 | if (200 <= mStatus && mStatus < 300) | ||
115 | { | ||
116 | LLSDSerialize::fromXML(content, istr); | ||
117 | /* | ||
118 | const S32 parseError = -1; | ||
119 | if(LLSDSerialize::fromXML(content, istr) == parseError) | ||
120 | { | ||
121 | mStatus = 498; | ||
122 | mReason = "Client Parse Error"; | ||
123 | } | ||
124 | */ | ||
125 | } | ||
126 | |||
127 | if (mResponder.get()) | 134 | if (mResponder.get()) |
128 | { | 135 | { |
129 | mResponder->completed(mStatus, mReason, content); | 136 | mResponder->completedRaw(mStatus, mReason, channels, buffer); |
130 | } | 137 | } |
131 | } | 138 | } |
132 | 139 | ||
@@ -243,15 +250,18 @@ namespace | |||
243 | LLPumpIO* theClientPump = NULL; | 250 | LLPumpIO* theClientPump = NULL; |
244 | } | 251 | } |
245 | 252 | ||
246 | static void request(const std::string& url, LLURLRequest::ERequestAction method, | 253 | static void request( |
247 | Injector* body_injector, LLHTTPClient::ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS) | 254 | const std::string& url, |
255 | LLURLRequest::ERequestAction method, | ||
256 | Injector* body_injector, | ||
257 | LLHTTPClient::ResponderPtr responder, | ||
258 | const F32 timeout=HTTP_REQUEST_EXPIRY_SECS) | ||
248 | { | 259 | { |
249 | if (!LLHTTPClient::hasPump()) | 260 | if (!LLHTTPClient::hasPump()) |
250 | { | 261 | { |
251 | responder->completed(U32_MAX, "No pump", LLSD()); | 262 | responder->completed(U32_MAX, "No pump", LLSD()); |
252 | return; | 263 | return; |
253 | } | 264 | } |
254 | |||
255 | LLPumpIO::chain_t chain; | 265 | LLPumpIO::chain_t chain; |
256 | 266 | ||
257 | LLURLRequest *req = new LLURLRequest(method, url); | 267 | LLURLRequest *req = new LLURLRequest(method, url); |
@@ -262,7 +272,8 @@ static void request(const std::string& url, LLURLRequest::ERequestAction method, | |||
262 | } | 272 | } |
263 | req->setCallback(new LLHTTPClientURLAdaptor(responder)); | 273 | req->setCallback(new LLHTTPClientURLAdaptor(responder)); |
264 | 274 | ||
265 | if (method == LLURLRequest::HTTP_POST && gMessageSystem) { | 275 | if (method == LLURLRequest::HTTP_POST && gMessageSystem) |
276 | { | ||
266 | req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", | 277 | req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", |
267 | gMessageSystem->mPort).c_str()); | 278 | gMessageSystem->mPort).c_str()); |
268 | } | 279 | } |