aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/CMakeLists.txt191
-rw-r--r--linden/indra/llmessage/files.lst71
-rw-r--r--linden/indra/llmessage/llares.cpp804
-rw-r--r--linden/indra/llmessage/llares.h572
-rw-r--r--linden/indra/llmessage/llassetstorage.cpp127
-rw-r--r--linden/indra/llmessage/llassetstorage.h25
-rw-r--r--linden/indra/llmessage/llcachename.cpp80
-rw-r--r--linden/indra/llmessage/llcachename.h6
-rw-r--r--linden/indra/llmessage/llcircuit.cpp20
-rw-r--r--linden/indra/llmessage/llcurl.cpp60
-rw-r--r--linden/indra/llmessage/llcurl.h33
-rw-r--r--linden/indra/llmessage/lldatapacker.cpp26
-rw-r--r--linden/indra/llmessage/lldatapacker.h8
-rw-r--r--linden/indra/llmessage/lldispatcher.cpp3
-rw-r--r--linden/indra/llmessage/llfiltersd2xmlrpc.cpp2
-rw-r--r--linden/indra/llmessage/llhost.cpp72
-rw-r--r--linden/indra/llmessage/llhost.h14
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp64
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.h18
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp111
-rw-r--r--linden/indra/llmessage/llhttpclient.h36
-rw-r--r--linden/indra/llmessage/llhttpnode.cpp27
-rw-r--r--linden/indra/llmessage/llhttpnode.h88
-rw-r--r--linden/indra/llmessage/llhttpsender.cpp2
-rw-r--r--linden/indra/llmessage/llhttpsender.h2
-rw-r--r--linden/indra/llmessage/llinstantmessage.cpp26
-rw-r--r--linden/indra/llmessage/llinstantmessage.h10
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp52
-rw-r--r--linden/indra/llmessage/lliopipe.cpp2
-rw-r--r--linden/indra/llmessage/lliopipe.h7
-rw-r--r--linden/indra/llmessage/lliosocket.cpp8
-rw-r--r--linden/indra/llmessage/lliosocket.h4
-rw-r--r--linden/indra/llmessage/llmail.cpp27
-rw-r--r--linden/indra/llmessage/llmessage.vcproj675
-rw-r--r--linden/indra/llmessage/llmessage_vc8.vcproj921
-rw-r--r--linden/indra/llmessage/llmessage_vc9.vcproj922
-rw-r--r--linden/indra/llmessage/llmessageconfig.cpp19
-rw-r--r--linden/indra/llmessage/llmessagereader.h1
-rw-r--r--linden/indra/llmessage/llmessagetemplateparser.cpp2
-rw-r--r--linden/indra/llmessage/llmessagethrottle.cpp4
-rw-r--r--linden/indra/llmessage/llmessagethrottle.h4
-rw-r--r--linden/indra/llmessage/llmime.cpp6
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp2
-rw-r--r--linden/indra/llmessage/llpumpio.cpp13
-rw-r--r--linden/indra/llmessage/llpumpio.h2
-rw-r--r--linden/indra/llmessage/llregionflags.h4
-rwxr-xr-xlinden/indra/llmessage/llsdmessagereader.cpp26
-rwxr-xr-xlinden/indra/llmessage/llsdmessagereader.h2
-rw-r--r--linden/indra/llmessage/llservicebuilder.cpp72
-rw-r--r--linden/indra/llmessage/llservicebuilder.h15
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.cpp16
-rw-r--r--linden/indra/llmessage/lltemplatemessagereader.h2
-rw-r--r--linden/indra/llmessage/lltransfersourcefile.cpp8
-rw-r--r--linden/indra/llmessage/lltransfersourcefile.h2
-rw-r--r--linden/indra/llmessage/lltransfertargetfile.cpp4
-rw-r--r--linden/indra/llmessage/lltransfertargetfile.h4
-rw-r--r--linden/indra/llmessage/llurlrequest.cpp11
-rw-r--r--linden/indra/llmessage/llurlrequest.h1
-rw-r--r--linden/indra/llmessage/llxfer.cpp18
-rw-r--r--linden/indra/llmessage/llxfer.h2
-rw-r--r--linden/indra/llmessage/llxfer_file.cpp44
-rw-r--r--linden/indra/llmessage/llxfer_file.h20
-rw-r--r--linden/indra/llmessage/llxfer_mem.cpp9
-rw-r--r--linden/indra/llmessage/llxfer_mem.h2
-rw-r--r--linden/indra/llmessage/llxfer_vfile.cpp10
-rw-r--r--linden/indra/llmessage/llxfer_vfile.h4
-rw-r--r--linden/indra/llmessage/llxfermanager.cpp26
-rw-r--r--linden/indra/llmessage/llxfermanager.h6
-rw-r--r--linden/indra/llmessage/mean_collision_data.h16
-rw-r--r--linden/indra/llmessage/message.cpp172
-rw-r--r--linden/indra/llmessage/message.h18
-rw-r--r--linden/indra/llmessage/message_prehash.cpp3
-rw-r--r--linden/indra/llmessage/message_prehash.h4
73 files changed, 2422 insertions, 3268 deletions
diff --git a/linden/indra/llmessage/CMakeLists.txt b/linden/indra/llmessage/CMakeLists.txt
new file mode 100644
index 0000000..ba17265
--- /dev/null
+++ b/linden/indra/llmessage/CMakeLists.txt
@@ -0,0 +1,191 @@
1# -*- cmake -*-
2
3project(llmessage)
4
5include(00-Common)
6include(LLCommon)
7include(LLMath)
8include(LLMessage)
9include(LLVFS)
10
11include_directories (${CMAKE_CURRENT_SOURCE_DIR})
12
13include_directories(
14 ${LLCOMMON_INCLUDE_DIRS}
15 ${LLMATH_INCLUDE_DIRS}
16 ${LLMESSAGE_INCLUDE_DIRS}
17 ${LLVFS_INCLUDE_DIRS}
18 )
19
20set(llmessage_SOURCE_FILES
21 llares.cpp
22 llassetstorage.cpp
23 llblowfishcipher.cpp
24 llbuffer.cpp
25 llbufferstream.cpp
26 llcachename.cpp
27 llchainio.cpp
28 llcircuit.cpp
29 llclassifiedflags.cpp
30 llcurl.cpp
31 lldatapacker.cpp
32 lldispatcher.cpp
33 llfiltersd2xmlrpc.cpp
34 llhost.cpp
35 llhttpassetstorage.cpp
36 llhttpclient.cpp
37 llhttpnode.cpp
38 llhttpsender.cpp
39 llinstantmessage.cpp
40 lliobuffer.cpp
41 lliohttpserver.cpp
42 lliopipe.cpp
43 lliosocket.cpp
44 llioutil.cpp
45 llmail.cpp
46 llmessagebuilder.cpp
47 llmessageconfig.cpp
48 llmessagereader.cpp
49 llmessagetemplate.cpp
50 llmessagetemplateparser.cpp
51 llmessagethrottle.cpp
52 llmime.cpp
53 llnamevalue.cpp
54 llnullcipher.cpp
55 llpacketack.cpp
56 llpacketbuffer.cpp
57 llpacketring.cpp
58 llpartdata.cpp
59 llpumpio.cpp
60 llsdappservices.cpp
61 llsdhttpserver.cpp
62 llsdmessagebuilder.cpp
63 llsdmessagereader.cpp
64 llsdrpcclient.cpp
65 llsdrpcserver.cpp
66 llservicebuilder.cpp
67 llservice.cpp
68 lltemplatemessagebuilder.cpp
69 lltemplatemessagereader.cpp
70 llthrottle.cpp
71 lltransfermanager.cpp
72 lltransfersourceasset.cpp
73 lltransfersourcefile.cpp
74 lltransfertargetfile.cpp
75 lltransfertargetvfile.cpp
76 llurlrequest.cpp
77 lluseroperation.cpp
78 llxfer.cpp
79 llxfer_file.cpp
80 llxfermanager.cpp
81 llxfer_mem.cpp
82 llxfer_vfile.cpp
83 llxorcipher.cpp
84 message.cpp
85 message_prehash.cpp
86 message_string_table.cpp
87 net.cpp
88 network.cpp
89 partsyspacket.cpp
90 patch_code.cpp
91 patch_dct.cpp
92 patch_idct.cpp
93 )
94
95set(llmessage_HEADER_FILES
96 CMakeLists.txt
97
98 llares.h
99 llassetstorage.h
100 llblowfishcipher.h
101 llbuffer.h
102 llbufferstream.h
103 llcachename.h
104 llchainio.h
105 llcipher.h
106 llcircuit.h
107 llclassifiedflags.h
108 llcurl.h
109 lldatapacker.h
110 lldbstrings.h
111 lldispatcher.h
112 lleventflags.h
113 llfiltersd2xmlrpc.h
114 llfollowcamparams.h
115 llhost.h
116 llhttpassetstorage.h
117 llhttpclient.h
118 llhttpnode.h
119 llhttpsender.h
120 llinstantmessage.h
121 llinvite.h
122 lliobuffer.h
123 lliohttpserver.h
124 lliopipe.h
125 lliosocket.h
126 llioutil.h
127 llloginflags.h
128 llmail.h
129 llmessagebuilder.h
130 llmessageconfig.h
131 llmessagereader.h
132 llmessagetemplate.h
133 llmessagetemplateparser.h
134 llmessagethrottle.h
135 llmime.h
136 llmsgvariabletype.h
137 llnamevalue.h
138 llnullcipher.h
139 llpacketack.h
140 llpacketbuffer.h
141 llpacketring.h
142 llpartdata.h
143 llpumpio.h
144 llqueryflags.h
145 llregionflags.h
146 llregionhandle.h
147 llsdappservices.h
148 llsdhttpserver.h
149 llsdmessagebuilder.h
150 llsdmessagereader.h
151 llsdrpcclient.h
152 llsdrpcserver.h
153 llservice.h
154 llservicebuilder.h
155 lltaskname.h
156 llteleportflags.h
157 lltemplatemessagebuilder.h
158 lltemplatemessagereader.h
159 llthrottle.h
160 lltransfermanager.h
161 lltransfersourceasset.h
162 lltransfersourcefile.h
163 lltransfertargetfile.h
164 lltransfertargetvfile.h
165 llurlrequest.h
166 lluseroperation.h
167 llvehicleparams.h
168 llxfer.h
169 llxfermanager.h
170 llxfer_file.h
171 llxfer_mem.h
172 llxfer_vfile.h
173 llxorcipher.h
174 machine.h
175 mean_collision_data.h
176 message.h
177 message_prehash.h
178 net.h
179 network.h
180 partsyspacket.h
181 patch_code.h
182 patch_dct.h
183 sound_ids.h
184 )
185
186set_source_files_properties(${llmessage_HEADER_FILES}
187 PROPERTIES HEADER_FILE_ONLY TRUE)
188
189list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES})
190
191add_library (llmessage ${llmessage_SOURCE_FILES})
diff --git a/linden/indra/llmessage/files.lst b/linden/indra/llmessage/files.lst
deleted file mode 100644
index 690cc37..0000000
--- a/linden/indra/llmessage/files.lst
+++ /dev/null
@@ -1,71 +0,0 @@
1llmessage/llassetstorage.cpp
2llmessage/llblowfishcipher.cpp
3llmessage/llbuffer.cpp
4llmessage/llbufferstream.cpp
5llmessage/llcachename.cpp
6llmessage/llchainio.cpp
7llmessage/llcircuit.cpp
8llmessage/llclassifiedflags.cpp
9llmessage/llcurl.cpp
10llmessage/lldatapacker.cpp
11llmessage/lldispatcher.cpp
12llmessage/llfiltersd2xmlrpc.cpp
13llmessage/llhost.cpp
14llmessage/llhttpassetstorage.cpp
15llmessage/llhttpclient.cpp
16llmessage/llhttpnode.cpp
17llmessage/llhttpsender.cpp
18llmessage/llinstantmessage.cpp
19llmessage/lliobuffer.cpp
20llmessage/lliohttpserver.cpp
21llmessage/lliopipe.cpp
22llmessage/lliosocket.cpp
23llmessage/llioutil.cpp
24llmessage/llmail.cpp
25llmessage/llmessagebuilder.cpp
26llmessage/llmessageconfig.cpp
27llmessage/llmessagereader.cpp
28llmessage/llmessagetemplate.cpp
29llmessage/llmessagetemplateparser.cpp
30llmessage/llmessagethrottle.cpp
31llmessage/llmime.cpp
32llmessage/llnamevalue.cpp
33llmessage/llnullcipher.cpp
34llmessage/llpacketack.cpp
35llmessage/llpacketbuffer.cpp
36llmessage/llpacketring.cpp
37llmessage/llpartdata.cpp
38llmessage/llpumpio.cpp
39llmessage/llsdappservices.cpp
40llmessage/llsdhttpserver.cpp
41llmessage/llsdmessagereader.cpp
42llmessage/llsdmessagebuilder.cpp
43llmessage/llsdrpcclient.cpp
44llmessage/llsdrpcserver.cpp
45llmessage/llservice.cpp
46llmessage/llservicebuilder.cpp
47llmessage/lltemplatemessagebuilder.cpp
48llmessage/lltemplatemessagereader.cpp
49llmessage/llthrottle.cpp
50llmessage/lltransfermanager.cpp
51llmessage/lltransfersourceasset.cpp
52llmessage/lltransfersourcefile.cpp
53llmessage/lltransfertargetfile.cpp
54llmessage/lltransfertargetvfile.cpp
55llmessage/llurlrequest.cpp
56llmessage/lluseroperation.cpp
57llmessage/llxfer.cpp
58llmessage/llxfer_file.cpp
59llmessage/llxfermanager.cpp
60llmessage/llxfer_mem.cpp
61llmessage/llxfer_vfile.cpp
62llmessage/llxorcipher.cpp
63llmessage/message.cpp
64llmessage/message_prehash.cpp
65llmessage/message_string_table.cpp
66llmessage/net.cpp
67llmessage/network.cpp
68llmessage/partsyspacket.cpp
69llmessage/patch_code.cpp
70llmessage/patch_dct.cpp
71llmessage/patch_idct.cpp
diff --git a/linden/indra/llmessage/llares.cpp b/linden/indra/llmessage/llares.cpp
new file mode 100644
index 0000000..5a310b3
--- /dev/null
+++ b/linden/indra/llmessage/llares.cpp
@@ -0,0 +1,804 @@
1/**
2 * @file llares.cpp
3 * @author Bryan O'Sullivan
4 * @date 2007-08-15
5 * @brief Wrapper for asynchronous DNS lookups.
6 *
7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 *
9 * Copyright (c) 2007-2008, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#include "linden_common.h"
35
36#include <ares_dns.h>
37#include <ares_version.h>
38
39#include "apr_portable.h"
40#include "apr_network_io.h"
41#include "apr_poll.h"
42
43#include "llapr.h"
44#include "llares.h"
45
46#if defined(LL_WINDOWS)
47# define ns_c_in 1
48# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
49# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
50# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
51#else
52# include <arpa/nameser.h>
53#endif
54
55LLAres::HostResponder::~HostResponder()
56{
57}
58
59void LLAres::HostResponder::hostResult(const hostent *ent)
60{
61 llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl;
62}
63
64void LLAres::HostResponder::hostError(int code)
65{
66 llinfos << "LLAres::HostResponder::hostError " << code << ": "
67 << LLAres::strerror(code) << llendl;
68}
69
70LLAres::NameInfoResponder::~NameInfoResponder()
71{
72}
73
74void LLAres::NameInfoResponder::nameInfoResult(const char *node,
75 const char *service)
76{
77 llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented"
78 << llendl;
79}
80
81void LLAres::NameInfoResponder::nameInfoError(int code)
82{
83 llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": "
84 << LLAres::strerror(code) << llendl;
85}
86
87LLAres::QueryResponder::~QueryResponder()
88{
89}
90
91void LLAres::QueryResponder::queryResult(const char *buf, size_t len)
92{
93 llinfos << "LLAres::QueryResponder::queryResult not implemented"
94 << llendl;
95}
96
97void LLAres::QueryResponder::queryError(int code)
98{
99 llinfos << "LLAres::QueryResponder::queryError " << code << ": "
100 << LLAres::strerror(code) << llendl;
101}
102
103LLAres::LLAres()
104{
105 ares_init(&chan_);
106}
107
108LLAres::~LLAres()
109{
110 ares_destroy(chan_);
111}
112
113void LLAres::cancel()
114{
115 ares_cancel(chan_);
116}
117
118static void host_callback_1_5(void *arg, int status, int timeouts,
119 struct hostent *ent)
120{
121 LLPointer<LLAres::HostResponder> *resp =
122 (LLPointer<LLAres::HostResponder> *) arg;
123
124 if (status == ARES_SUCCESS)
125 {
126 (*resp)->hostResult(ent);
127 } else {
128 (*resp)->hostError(status);
129 }
130
131 delete resp;
132}
133
134#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
135static void host_callback(void *arg, int status, struct hostent *ent)
136{
137 host_callback_1_5(arg, status, 0, ent);
138}
139#else
140# define host_callback host_callback_1_5
141#endif
142
143void LLAres::getHostByName(const char *name, HostResponder *resp,
144 int family)
145{
146 ares_gethostbyname(chan_, name, family, host_callback,
147 new LLPointer<LLAres::HostResponder>(resp));
148}
149
150void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp)
151{
152 search(name, RES_SRV, resp);
153}
154
155void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
156{
157 llinfos << "Rewriting " << uri << llendl;
158
159 resp->mUri = LLURI(uri);
160 search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(),
161 RES_SRV, resp);
162}
163
164LLQueryResponder::LLQueryResponder()
165 : LLAres::QueryResponder(),
166 mResult(ARES_ENODATA)
167{
168}
169
170int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos,
171 LLPointer<LLDnsRecord> &r)
172{
173 std::string rrname;
174 size_t enclen;
175 int ret;
176
177 // RR name.
178
179 ret = LLAres::expandName(pos, buf, len, rrname, enclen);
180 if (ret != ARES_SUCCESS)
181 {
182 return ret;
183 }
184
185 pos += enclen;
186
187 if (pos + NS_RRFIXEDSZ > buf + len)
188 {
189 return ARES_EBADRESP;
190 }
191
192 int rrtype = DNS_RR_TYPE(pos);
193 int rrclass = DNS_RR_CLASS(pos);
194 int rrttl = DNS_RR_TTL(pos);
195 int rrlen = DNS_RR_LEN(pos);
196
197 if (rrclass != ns_c_in)
198 {
199 return ARES_EBADRESP;
200 }
201
202 pos += NS_RRFIXEDSZ;
203
204 if (pos + rrlen > buf + len)
205 {
206 return ARES_EBADRESP;
207 }
208
209 switch (rrtype)
210 {
211 case RES_A:
212 r = new LLARecord(rrname, rrttl);
213 break;
214 case RES_NS:
215 r = new LLNsRecord(rrname, rrttl);
216 break;
217 case RES_CNAME:
218 r = new LLCnameRecord(rrname, rrttl);
219 break;
220 case RES_PTR:
221 r = new LLPtrRecord(rrname, rrttl);
222 break;
223 case RES_AAAA:
224 r = new LLAaaaRecord(rrname, rrttl);
225 break;
226 case RES_SRV:
227 r = new LLSrvRecord(rrname, rrttl);
228 break;
229 default:
230 llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype
231 << llendl;
232 return ARES_EBADRESP;
233 }
234
235 ret = r->parse(buf, len, pos, rrlen);
236
237 if (ret == ARES_SUCCESS)
238 {
239 pos += rrlen;
240 } else {
241 r = NULL;
242 }
243
244 return ret;
245}
246
247int LLQueryResponder::parseSection(const char *buf, size_t len,
248 size_t count, const char *&pos,
249 dns_rrs_t &rrs)
250{
251 int ret = ARES_SUCCESS;
252
253 for (size_t i = 0; i < count; i++)
254 {
255 LLPointer<LLDnsRecord> r;
256 ret = parseRR(buf, len, pos, r);
257 if (ret != ARES_SUCCESS)
258 {
259 break;
260 }
261 rrs.push_back(r);
262 }
263
264 return ret;
265}
266
267void LLQueryResponder::queryResult(const char *buf, size_t len)
268{
269 const char *pos = buf;
270 int qdcount = DNS_HEADER_QDCOUNT(pos);
271 int ancount = DNS_HEADER_ANCOUNT(pos);
272 int nscount = DNS_HEADER_NSCOUNT(pos);
273 int arcount = DNS_HEADER_ARCOUNT(pos);
274 int ret;
275
276 if (qdcount == 0 || ancount + nscount + arcount == 0)
277 {
278 ret = ARES_ENODATA;
279 goto bail;
280 }
281
282 pos += NS_HFIXEDSZ;
283
284 for (int i = 0; i < qdcount; i++)
285 {
286 std::string ignore;
287 size_t enclen;
288
289 ret = LLAres::expandName(pos, buf, len, i == 0 ? mQuery : ignore,
290 enclen);
291 if (ret != ARES_SUCCESS)
292 {
293 goto bail;
294 }
295
296 pos += enclen;
297
298 if (i == 0)
299 {
300 int t = DNS_QUESTION_TYPE(pos);
301 switch (t)
302 {
303 case RES_A:
304 case RES_NS:
305 case RES_CNAME:
306 case RES_PTR:
307 case RES_AAAA:
308 case RES_SRV:
309 mType = (LLResType) t;
310 break;
311 default:
312 llinfos << "Cannot grok query type " << t << llendl;
313 ret = ARES_EBADQUERY;
314 goto bail;
315 }
316 }
317
318 pos += NS_QFIXEDSZ;
319 if (pos > buf + len)
320 {
321 ret = ARES_EBADRESP;
322 goto bail;
323 }
324 }
325
326 ret = parseSection(buf, len, ancount, pos, mAnswers);
327 if (ret != ARES_SUCCESS)
328 {
329 goto bail;
330 }
331
332 ret = parseSection(buf, len, nscount, pos, mAuthorities);
333 if (ret != ARES_SUCCESS)
334 {
335 goto bail;
336 }
337
338 ret = parseSection(buf, len, arcount, pos, mAdditional);
339
340bail:
341 mResult = ret;
342 if (mResult == ARES_SUCCESS)
343 {
344 querySuccess();
345 } else {
346 queryError(mResult);
347 }
348}
349
350void LLQueryResponder::querySuccess()
351{
352 llinfos << "LLQueryResponder::queryResult not implemented" << llendl;
353}
354
355void LLAres::SrvResponder::querySuccess()
356{
357 if (mType == RES_SRV)
358 {
359 srvResult(mAnswers);
360 } else {
361 srvError(ARES_EBADRESP);
362 }
363}
364
365void LLAres::SrvResponder::queryError(int code)
366{
367 srvError(code);
368}
369
370void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents)
371{
372 llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl;
373
374 for (size_t i = 0; i < ents.size(); i++)
375 {
376 const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get();
377
378 llinfos << "[" << i << "] " << s->host() << ":" << s->port()
379 << " priority " << s->priority()
380 << " weight " << s->weight()
381 << llendl;
382 }
383}
384
385void LLAres::SrvResponder::srvError(int code)
386{
387 llinfos << "LLAres::SrvResponder::srvError " << code << ": "
388 << LLAres::strerror(code) << llendl;
389}
390
391static void nameinfo_callback_1_5(void *arg, int status, int timeouts,
392 char *node, char *service)
393{
394 LLPointer<LLAres::NameInfoResponder> *resp =
395 (LLPointer<LLAres::NameInfoResponder> *) arg;
396
397 if (status == ARES_SUCCESS)
398 {
399 (*resp)->nameInfoResult(node, service);
400 } else {
401 (*resp)->nameInfoError(status);
402 }
403
404 delete resp;
405}
406
407#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
408static void nameinfo_callback(void *arg, int status, char *node, char *service)
409{
410 nameinfo_callback_1_5(arg, status, 0, node, service);
411}
412#else
413# define nameinfo_callback nameinfo_callback_1_5
414#endif
415
416void LLAres::getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags,
417 NameInfoResponder *resp)
418{
419 ares_getnameinfo(chan_, &sa, salen, flags, nameinfo_callback,
420 new LLPointer<NameInfoResponder>(resp));
421}
422
423static void search_callback_1_5(void *arg, int status, int timeouts,
424 unsigned char *abuf, int alen)
425{
426 LLPointer<LLAres::QueryResponder> *resp =
427 (LLPointer<LLAres::QueryResponder> *) arg;
428
429 if (status == ARES_SUCCESS)
430 {
431 (*resp)->queryResult((const char *) abuf, alen);
432 } else {
433 (*resp)->queryError(status);
434 }
435
436 delete resp;
437}
438
439#if ARES_VERSION_MAJOR == 1 && ARES_VERSION_MINOR == 4
440static void search_callback(void *arg, int status, unsigned char *abuf,
441 int alen)
442{
443 search_callback_1_5(arg, status, 0, abuf, alen);
444}
445#else
446# define search_callback search_callback_1_5
447#endif
448
449void LLAres::search(const std::string &query, LLResType type,
450 QueryResponder *resp)
451{
452 ares_search(chan_, query.c_str(), ns_c_in, type, search_callback,
453 new LLPointer<QueryResponder>(resp));
454}
455
456bool LLAres::process(U64 timeout)
457{
458 if (!gAPRPoolp)
459 {
460 ll_init_apr();
461 }
462
463 int socks[ARES_GETSOCK_MAXNUM];
464 apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
465 apr_int32_t nsds = 0;
466 apr_status_t status;
467 apr_pool_t *pool;
468 int nactive = 0;
469 int bitmask;
470
471 bitmask = ares_getsock(chan_, socks, ARES_GETSOCK_MAXNUM);
472
473 if (bitmask == 0)
474 {
475 goto bail;
476 }
477
478 status = apr_pool_create(&pool, gAPRPoolp);
479 ll_apr_assert_status(status);
480
481 for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
482 {
483 if (ARES_GETSOCK_READABLE(bitmask, i))
484 {
485 aprFds[nactive].reqevents = APR_POLLIN | APR_POLLERR;
486 }
487 else if (ARES_GETSOCK_WRITABLE(bitmask, i))
488 {
489 aprFds[nactive].reqevents = APR_POLLOUT | APR_POLLERR;
490 } else {
491 continue;
492 }
493
494 apr_socket_t *aprSock = NULL;
495
496 status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], pool);
497 if (status != APR_SUCCESS)
498 {
499 ll_apr_warn_status(status);
500 goto bail_pool;
501 }
502
503 aprFds[nactive].desc.s = aprSock;
504 aprFds[nactive].desc_type = APR_POLL_SOCKET;
505 aprFds[nactive].p = pool;
506 aprFds[nactive].rtnevents = 0;
507 aprFds[nactive].client_data = &socks[i];
508
509 nactive++;
510 }
511
512 if (nactive > 0)
513 {
514 status = apr_poll(aprFds, nactive, &nsds, timeout);
515
516 if (status != APR_SUCCESS && status != APR_TIMEUP)
517 {
518 ll_apr_warn_status(status);
519 }
520
521 for (int i = 0; i < nactive; i++)
522 {
523 int evts = aprFds[i].rtnevents;
524 int ifd = (evts & (APR_POLLIN | APR_POLLERR))
525 ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD;
526 int ofd = (evts & (APR_POLLOUT | APR_POLLERR))
527 ? *((int *) aprFds[i].client_data) : ARES_SOCKET_BAD;
528
529 ares_process_fd(chan_, ifd, ofd);
530 }
531 }
532
533bail_pool:
534 apr_pool_destroy(pool);
535
536bail:
537 return nsds > 0;
538}
539
540bool LLAres::processAll()
541{
542 bool anyProcessed = false, ret;
543
544 do {
545 timeval tv;
546
547 ret = ares_timeout(chan_, NULL, &tv) != NULL;
548
549 if (ret)
550 {
551 ret = process(tv.tv_sec * 1000000LL + tv.tv_usec);
552 anyProcessed |= ret;
553 }
554 } while (ret);
555
556 return anyProcessed;
557}
558
559int LLAres::expandName(const char *encoded, const char *abuf, size_t alen,
560 std::string &s, size_t &enclen)
561{
562 char *t;
563 int ret;
564 long e;
565
566 ret = ares_expand_name((const unsigned char *) encoded,
567 (const unsigned char *) abuf, alen, &t, &e);
568 if (ret == ARES_SUCCESS)
569 {
570 s.assign(t);
571 enclen = e;
572 ares_free_string(t);
573 }
574 return ret;
575}
576
577const char *LLAres::strerror(int code)
578{
579 return ares_strerror(code);
580}
581
582LLAres *gAres;
583
584LLAres *ll_init_ares()
585{
586 if (gAres == NULL)
587 {
588 gAres = new LLAres();
589 }
590 return gAres;
591}
592
593LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name,
594 unsigned ttl)
595 : LLRefCount(),
596 mType(type),
597 mName(name),
598 mTTL(ttl)
599{
600}
601
602LLHostRecord::LLHostRecord(LLResType type, const std::string &name,
603 unsigned ttl)
604 : LLDnsRecord(type, name, ttl)
605{
606}
607
608int LLHostRecord::parse(const char *buf, size_t len, const char *pos,
609 size_t rrlen)
610{
611 int ret;
612
613 ret = LLAres::expandName(pos, buf, len, mHost);
614 if (ret != ARES_SUCCESS)
615 {
616 goto bail;
617 }
618
619 ret = ARES_SUCCESS;
620
621bail:
622 return ret;
623}
624
625LLCnameRecord::LLCnameRecord(const std::string &name, unsigned ttl)
626 : LLHostRecord(RES_CNAME, name, ttl)
627{
628}
629
630LLPtrRecord::LLPtrRecord(const std::string &name, unsigned ttl)
631 : LLHostRecord(RES_PTR, name, ttl)
632{
633}
634
635LLAddrRecord::LLAddrRecord(LLResType type, const std::string &name,
636 unsigned ttl)
637 : LLDnsRecord(type, name, ttl)
638{
639}
640
641LLARecord::LLARecord(const std::string &name, unsigned ttl)
642 : LLAddrRecord(RES_A, name, ttl)
643{
644}
645
646int LLARecord::parse(const char *buf, size_t len, const char *pos,
647 size_t rrlen)
648{
649 int ret;
650
651 if (rrlen != sizeof(mSA.sin.sin_addr.s_addr))
652 {
653 ret = ARES_EBADRESP;
654 goto bail;
655 }
656
657 memset(&mSA, 0, sizeof(mSA));
658 memcpy(&mSA.sin.sin_addr.s_addr, pos, rrlen);
659 mSA.sin.sin_family = AF_INET6;
660 mSize = sizeof(mSA.sin);
661
662 ret = ARES_SUCCESS;
663
664bail:
665 return ret;
666}
667
668LLAaaaRecord::LLAaaaRecord(const std::string &name, unsigned ttl)
669 : LLAddrRecord(RES_AAAA, name, ttl)
670{
671}
672
673int LLAaaaRecord::parse(const char *buf, size_t len, const char *pos,
674 size_t rrlen)
675{
676 int ret;
677
678 if (rrlen != sizeof(mSA.sin6.sin6_addr))
679 {
680 ret = ARES_EBADRESP;
681 goto bail;
682 }
683
684 memset(&mSA, 0, sizeof(mSA));
685 memcpy(&mSA.sin6.sin6_addr.s6_addr, pos, rrlen);
686 mSA.sin6.sin6_family = AF_INET6;
687 mSize = sizeof(mSA.sin6);
688
689 ret = ARES_SUCCESS;
690
691bail:
692 return ret;
693}
694
695LLSrvRecord::LLSrvRecord(const std::string &name, unsigned ttl)
696 : LLHostRecord(RES_SRV, name, ttl)
697{
698}
699
700int LLSrvRecord::parse(const char *buf, size_t len, const char *pos,
701 size_t rrlen)
702{
703 int ret;
704
705 if (rrlen < 6)
706 {
707 ret = ARES_EBADRESP;
708 goto bail;
709 }
710
711 memcpy(&mPriority, pos, 2);
712 memcpy(&mWeight, pos + 2, 2);
713 memcpy(&mPort, pos + 4, 2);
714
715 mPriority = ntohs(mPriority);
716 mWeight = ntohs(mWeight);
717 mPort = ntohs(mPort);
718
719 ret = LLHostRecord::parse(buf, len, pos + 6, rrlen - 6);
720
721bail:
722 return ret;
723}
724
725LLNsRecord::LLNsRecord(const std::string &name, unsigned ttl)
726 : LLHostRecord(RES_NS, name, ttl)
727{
728}
729
730void LLAres::UriRewriteResponder::queryError(int code)
731{
732 std::vector<std::string> uris;
733 uris.push_back(mUri.asString());
734 rewriteResult(uris);
735}
736
737void LLAres::UriRewriteResponder::querySuccess()
738{
739 std::vector<std::string> uris;
740
741 if (mType != RES_SRV)
742 {
743 goto bail;
744 }
745
746 for (size_t i = 0; i < mAnswers.size(); i++)
747 {
748 const LLSrvRecord *r = (const LLSrvRecord *) mAnswers[i].get();
749
750 if (r->type() == RES_SRV)
751 {
752 // Check the domain in the response to ensure that it's
753 // the same as the domain in the request, so that bad guys
754 // can't forge responses that point to their own login
755 // servers with their own certificates.
756
757 // Hard-coding the domain to check here is a bit of a
758 // hack. Hoist it to an outer caller if anyone ever needs
759 // this functionality on other domains.
760
761 static const std::string domain(".lindenlab.com");
762 const std::string &host = r->host();
763
764 std::string::size_type s = host.find(domain) + domain.length();
765
766 if (s != host.length() && s != host.length() - 1)
767 {
768 continue;
769 }
770
771 LLURI uri(mUri.scheme(),
772 mUri.userName(),
773 mUri.password(),
774 r->host(),
775 mUri.defaultPort() ? r->port() : mUri.hostPort(),
776 mUri.escapedPath(),
777 mUri.escapedQuery());
778 uris.push_back(uri.asString());
779 }
780 }
781
782 if (!uris.empty())
783 {
784 goto done;
785 }
786
787bail:
788 uris.push_back(mUri.asString());
789
790done:
791 rewriteResult(uris);
792}
793
794void LLAres::UriRewriteResponder::rewriteResult(
795 const std::vector<std::string> &uris)
796{
797 llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented"
798 << llendl;
799
800 for (size_t i = 0; i < uris.size(); i++)
801 {
802 llinfos << "[" << i << "] " << uris[i] << llendl;
803 }
804}
diff --git a/linden/indra/llmessage/llares.h b/linden/indra/llmessage/llares.h
new file mode 100644
index 0000000..5d72170
--- /dev/null
+++ b/linden/indra/llmessage/llares.h
@@ -0,0 +1,572 @@
1/**
2 * @file llares.h
3 * @author Bryan O'Sullivan
4 * @date 2007-08-15
5 * @brief Wrapper for asynchronous DNS lookups.
6 *
7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 *
9 * Copyright (c) 2007-2008, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#ifndef LL_LLARES_H
35#define LL_LLARES_H
36
37#ifdef LL_WINDOWS
38# include <ws2tcpip.h>
39#endif
40
41#ifdef LL_STANDALONE
42# include <ares.h>
43#else
44# include <ares/ares.h>
45#endif
46
47#include "llmemory.h"
48#include "lluri.h"
49
50class LLQueryResponder;
51
52/**
53 * @brief Supported DNS RR types.
54 */
55enum LLResType
56{
57 RES_INVALID = 0, /**< Cookie. */
58 RES_A = 1, /**< "A" record. IPv4 address. */
59 RES_NS = 2, /**< "NS" record. Authoritative server. */
60 RES_CNAME = 5, /**< "CNAME" record. Canonical name. */
61 RES_PTR = 12, /**< "PTR" record. Domain name pointer. */
62 RES_AAAA = 28, /**< "AAAA" record. IPv6 Address. */
63 RES_SRV = 33, /**< "SRV" record. Server Selection. */
64 RES_MAX = 65536 /**< Sentinel; RR types are 16 bits wide. */
65};
66
67/**
68 * @class LLDnsRecord
69 * @brief Base class for all DNS RR types.
70 */
71class LLDnsRecord : public LLRefCount
72{
73protected:
74 friend class LLQueryResponder;
75
76 LLResType mType;
77 std::string mName;
78 unsigned mTTL;
79
80 virtual int parse(const char *buf, size_t len, const char *pos,
81 size_t rrlen) = 0;
82
83 LLDnsRecord(LLResType type, const std::string &name, unsigned ttl);
84
85public:
86 /**
87 * @brief Record name.
88 */
89 const std::string &name() const { return mName; }
90
91 /**
92 * @brief Time-to-live value, in seconds.
93 */
94 unsigned ttl() const { return mTTL; }
95
96 /**
97 * @brief RR type.
98 */
99 LLResType type() const { return mType; }
100};
101
102/**
103 * @class LLAddrRecord
104 * @brief Base class for address-related RRs.
105 */
106class LLAddrRecord : public LLDnsRecord
107{
108protected:
109 friend class LLQueryResponder;
110
111 LLAddrRecord(LLResType type, const std::string &name, unsigned ttl);
112
113 union
114 {
115 sockaddr sa;
116 sockaddr_in sin;
117 sockaddr_in6 sin6;
118 } mSA;
119
120 socklen_t mSize;
121
122public:
123 /**
124 * @brief Generic socket address.
125 */
126 const sockaddr &addr() const { return mSA.sa; }
127
128 /**
129 * @brief Size of the socket structure.
130 */
131 socklen_t size() const { return mSize; }
132};
133
134/**
135 * @class LLARecord
136 * @brief A RR, for IPv4 addresses.
137 */
138class LLARecord : public LLAddrRecord
139{
140protected:
141 friend class LLQueryResponder;
142
143 LLARecord(const std::string &name, unsigned ttl);
144
145 int parse(const char *buf, size_t len, const char *pos, size_t rrlen);
146
147public:
148 /**
149 * @brief Socket address.
150 */
151 const sockaddr_in &addr_in() const { return mSA.sin; }
152};
153
154/**
155 * @class LLAaaaRecord
156 * @brief AAAA RR, for IPv6 addresses.
157 */
158class LLAaaaRecord : public LLAddrRecord
159{
160protected:
161 friend class LLQueryResponder;
162
163 LLAaaaRecord(const std::string &name, unsigned ttl);
164
165 int parse(const char *buf, size_t len, const char *pos, size_t rrlen);
166
167public:
168 /**
169 * @brief Socket address.
170 */
171 const sockaddr_in6 &addr_in6() const { return mSA.sin6; }
172};
173
174/**
175 * @class LLHostRecord
176 * @brief Base class for host-related RRs.
177 */
178class LLHostRecord : public LLDnsRecord
179{
180protected:
181 LLHostRecord(LLResType type, const std::string &name, unsigned ttl);
182
183 int parse(const char *buf, size_t len, const char *pos, size_t rrlen);
184
185 std::string mHost;
186
187public:
188 /**
189 * @brief Host name.
190 */
191 const std::string &host() const { return mHost; }
192};
193
194/**
195 * @class LLCnameRecord
196 * @brief CNAME RR.
197 */
198class LLCnameRecord : public LLHostRecord
199{
200protected:
201 friend class LLQueryResponder;
202
203 LLCnameRecord(const std::string &name, unsigned ttl);
204};
205
206/**
207 * @class LLPtrRecord
208 * @brief PTR RR.
209 */
210class LLPtrRecord : public LLHostRecord
211{
212protected:
213 friend class LLQueryResponder;
214
215 LLPtrRecord(const std::string &name, unsigned ttl);
216};
217
218/**
219 * @class LLSrvRecord
220 * @brief SRV RR.
221 */
222class LLSrvRecord : public LLHostRecord
223{
224protected:
225 U16 mPriority;
226 U16 mWeight;
227 U16 mPort;
228
229 int parse(const char *buf, size_t len, const char *pos, size_t rrlen);
230
231public:
232 LLSrvRecord(const std::string &name, unsigned ttl);
233
234 /**
235 * @brief Service priority.
236 */
237 U16 priority() const { return mPriority; }
238
239 /**
240 * @brief Service weight.
241 */
242 U16 weight() const { return mWeight; }
243
244 /**
245 * @brief Port number of service.
246 */
247 U16 port() const { return mPort; }
248
249 /**
250 * @brief Functor for sorting SRV records by priority.
251 */
252 struct ComparePriorityLowest
253 {
254 bool operator()(const LLSrvRecord& lhs, const LLSrvRecord& rhs)
255 {
256 return lhs.mPriority < rhs.mPriority;
257 }
258 };
259};
260
261/**
262 * @class LLNsRecord
263 * @brief NS RR.
264 */
265class LLNsRecord : public LLHostRecord
266{
267public:
268 LLNsRecord(const std::string &name, unsigned ttl);
269};
270
271class LLQueryResponder;
272
273/**
274 * @class LLAres
275 * @brief Asynchronous address resolver.
276 */
277class LLAres
278{
279public:
280 /**
281 * @class HostResponder
282 * @brief Base class for responding to hostname lookups.
283 * @see LLAres::getHostByName
284 */
285 class HostResponder : public LLRefCount
286 {
287 public:
288 virtual ~HostResponder();
289
290 virtual void hostResult(const hostent *ent);
291 virtual void hostError(int code);
292 };
293
294 /**
295 * @class NameInfoResponder
296 * @brief Base class for responding to address lookups.
297 * @see LLAres::getNameInfo
298 */
299 class NameInfoResponder : public LLRefCount
300 {
301 public:
302 virtual ~NameInfoResponder();
303
304 virtual void nameInfoResult(const char *node, const char *service);
305 virtual void nameInfoError(int code);
306 };
307
308 /**
309 * @class QueryResponder
310 * @brief Base class for responding to custom searches.
311 * @see LLAres::search
312 */
313 class QueryResponder : public LLRefCount
314 {
315 public:
316 virtual ~QueryResponder();
317
318 virtual void queryResult(const char *buf, size_t len);
319 virtual void queryError(int code);
320 };
321
322 class SrvResponder;
323 class UriRewriteResponder;
324
325 LLAres();
326
327 ~LLAres();
328
329 /**
330 * Cancel all outstanding requests. The error methods of the
331 * corresponding responders will be called, with ARES_ETIMEOUT.
332 */
333 void cancel();
334
335 /**
336 * Look up the address of a host.
337 *
338 * @param name name of host to look up
339 * @param resp responder to call with result
340 * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6
341 */
342 void getHostByName(const std::string &name, HostResponder *resp,
343 int family = AF_INET) {
344 getHostByName(name.c_str(), resp, family);
345 }
346
347 /**
348 * Look up the address of a host.
349 *
350 * @param name name of host to look up
351 * @param resp responder to call with result
352 * @param family AF_INET for IPv4 addresses, AF_INET6 for IPv6
353 */
354 void getHostByName(const char *name, HostResponder *resp,
355 int family = PF_INET);
356
357 /**
358 * Look up the name associated with a socket address.
359 *
360 * @param sa socket address to look up
361 * @param salen size of socket address
362 * @param flags flags to use
363 * @param resp responder to call with result
364 */
365 void getNameInfo(const struct sockaddr &sa, socklen_t salen, int flags,
366 NameInfoResponder *resp);
367
368 /**
369 * Look up SRV (service location) records for a service name.
370 *
371 * @param name service name (e.g. "_https._tcp.login.agni.lindenlab.com")
372 * @param resp responder to call with result
373 */
374 void getSrvRecords(const std::string &name, SrvResponder *resp);
375
376 /**
377 * Rewrite a URI, using SRV (service location) records for its
378 * protocol if available. If no SRV records are published, the
379 * existing URI is handed to the responder.
380 *
381 * @param uri URI to rewrite
382 * @param resp responder to call with result
383 */
384 void rewriteURI(const std::string &uri,
385 UriRewriteResponder *resp);
386
387 /**
388 * Start a custom search.
389 *
390 * @param query query to make
391 * @param type type of query to perform
392 * @param resp responder to call with result
393 */
394 void search(const std::string &query, LLResType type,
395 QueryResponder *resp);
396
397 /**
398 * Process any outstanding queries. This method takes an optional
399 * timeout parameter (specified in microseconds). If provided, it
400 * will block the calling thread for that length of time to await
401 * possible responses. A timeout of zero will return immediately
402 * if there are no responses or timeouts to process.
403 *
404 * @param timeoutUsecs number of microseconds to block before timing out
405 * @return whether any responses were processed
406 */
407 bool process(U64 timeoutUsecs = 0);
408
409 /**
410 * Process all outstanding queries, blocking the calling thread
411 * until all have either been responded to or timed out.
412 *
413 * @return whether any responses were processed
414 */
415 bool processAll();
416
417 /**
418 * Expand a DNS-encoded compressed string into a normal string.
419 *
420 * @param encoded the encoded name (null-terminated)
421 * @param abuf the response buffer in which the string is embedded
422 * @param alen the length of the response buffer
423 * @param s the string into which to place the result
424 * @return ARES_SUCCESS on success, otherwise an error indicator
425 */
426 static int expandName(const char *encoded, const char *abuf, size_t alen,
427 std::string &s) {
428 size_t ignore;
429 return expandName(encoded, abuf, alen, s, ignore);
430 }
431
432 static int expandName(const char *encoded, const char *abuf, size_t alen,
433 std::string &s, size_t &enclen);
434
435 /**
436 * Return a string describing an error code.
437 */
438 static const char *strerror(int code);
439
440protected:
441 ares_channel chan_;
442
443};
444
445/**
446 * An ordered collection of DNS resource records.
447 */
448typedef std::vector<LLPointer<LLDnsRecord> > dns_rrs_t;
449
450/**
451 * @class LLQueryResponder
452 * @brief Base class for friendly handling of DNS query responses.
453 *
454 * This class parses a DNS response and represents it in a friendly
455 * manner.
456 *
457 * @see LLDnsRecord
458 * @see LLARecord
459 * @see LLNsRecord
460 * @see LLCnameRecord
461 * @see LLPtrRecord
462 * @see LLAaaaRecord
463 * @see LLSrvRecord
464 */
465class LLQueryResponder : public LLAres::QueryResponder
466{
467protected:
468 int mResult;
469 std::string mQuery;
470 LLResType mType;
471
472 dns_rrs_t mAnswers;
473 dns_rrs_t mAuthorities;
474 dns_rrs_t mAdditional;
475
476 /**
477 * Parse a single RR.
478 */
479 int parseRR(const char *buf, size_t len, const char *&pos,
480 LLPointer<LLDnsRecord> &r);
481 /**
482 * Parse one section of a response.
483 */
484 int parseSection(const char *buf, size_t len,
485 size_t count, const char *& pos, dns_rrs_t &rrs);
486
487 void queryResult(const char *buf, size_t len);
488 virtual void querySuccess();
489
490public:
491 LLQueryResponder();
492
493 /**
494 * Indicate whether the response could be parsed successfully.
495 */
496 bool valid() const { return mResult == ARES_SUCCESS; }
497
498 /**
499 * The more detailed result of parsing the response.
500 */
501 int result() const { return mResult; }
502
503 /**
504 * Return the query embedded in the response.
505 */
506 const std::string &query() const { return mQuery; }
507
508 /**
509 * Return the contents of the "answers" section of the response.
510 */
511 const dns_rrs_t &answers() const { return mAnswers; }
512
513 /**
514 * Return the contents of the "authorities" section of the
515 * response.
516 */
517 const dns_rrs_t &authorities() const { return mAuthorities; }
518
519 /**
520 * Return the contents of the "additional records" section of the
521 * response.
522 */
523 const dns_rrs_t &additional() const { return mAdditional; }
524};
525
526/**
527 * @class LLAres::SrvResponder
528 * @brief Class for handling SRV query responses.
529 */
530class LLAres::SrvResponder : public LLQueryResponder
531{
532public:
533 friend void LLAres::getSrvRecords(const std::string &name,
534 SrvResponder *resp);
535 void querySuccess();
536 void queryError(int code);
537
538 virtual void srvResult(const dns_rrs_t &ents);
539 virtual void srvError(int code);
540};
541
542/**
543 * @class LLAres::UriRewriteResponder
544 * @brief Class for handling URI rewrites based on SRV records.
545 */
546class LLAres::UriRewriteResponder : public LLQueryResponder
547{
548protected:
549 LLURI mUri;
550
551public:
552 friend void LLAres::rewriteURI(const std::string &uri,
553 UriRewriteResponder *resp);
554 void querySuccess();
555 void queryError(int code);
556
557 virtual void rewriteResult(const std::vector<std::string> &uris);
558};
559
560/**
561 * Singleton responder.
562 */
563extern LLAres *gAres;
564
565/**
566 * Set up the singleton responder. It's safe to call this more than
567 * once from within a single thread, but this function is not
568 * thread safe.
569 */
570extern LLAres *ll_init_ares();
571
572#endif // LL_LLARES_H
diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp
index a6077e5..fa14a2b 100644
--- a/linden/indra/llmessage/llassetstorage.cpp
+++ b/linden/indra/llmessage/llassetstorage.cpp
@@ -42,6 +42,7 @@
42#include "llstring.h" 42#include "llstring.h"
43#include "lldir.h" 43#include "lldir.h"
44#include "llsd.h" 44#include "llsd.h"
45#include "llframetimer.h"
45 46
46// this library includes 47// this library includes
47#include "message.h" 48#include "message.h"
@@ -58,7 +59,10 @@
58LLAssetStorage *gAssetStorage = NULL; 59LLAssetStorage *gAssetStorage = NULL;
59LLMetrics *LLAssetStorage::metric_recipient = NULL; 60LLMetrics *LLAssetStorage::metric_recipient = NULL;
60 61
61const LLUUID CATEGORIZE_LOST_AND_FOUND_ID("00000000-0000-0000-0000-000000000010"); 62const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010"));
63
64const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds
65
62 66
63///---------------------------------------------------------------------------- 67///----------------------------------------------------------------------------
64/// LLAssetInfo 68/// LLAssetInfo
@@ -133,20 +137,20 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
133 str.assign( nv.mName ); 137 str.assign( nv.mName );
134 pos1 = str.find('|'); 138 pos1 = str.find('|');
135 buf.assign( str, 0, pos1++ ); 139 buf.assign( str, 0, pos1++ );
136 mType = LLAssetType::lookup( buf.c_str() ); 140 mType = LLAssetType::lookup( buf );
137 buf.assign( str, pos1, std::string::npos ); 141 buf.assign( str, pos1, std::string::npos );
138 mUuid.set( buf.c_str() ); 142 mUuid.set( buf );
139 143
140 // convert the value to useful information 144 // convert the value to useful information
141 str.assign( nv.getAsset() ); 145 str.assign( nv.getAsset() );
142 pos1 = str.find('|'); 146 pos1 = str.find('|');
143 buf.assign( str, 0, pos1++ ); 147 buf.assign( str, 0, pos1++ );
144 mCreatorID.set( buf.c_str() ); 148 mCreatorID.set( buf );
145 pos2 = str.find( '|', pos1 ); 149 pos2 = str.find( '|', pos1 );
146 buf.assign( str, pos1, (pos2++) - pos1 ); 150 buf.assign( str, pos1, (pos2++) - pos1 );
147 setName( buf.c_str() ); 151 setName( buf );
148 buf.assign( str, pos2, std::string::npos ); 152 buf.assign( str, pos2, std::string::npos );
149 setDescription( buf.c_str() ); 153 setDescription( buf );
150 llinfos << "uuid: " << mUuid << llendl; 154 llinfos << "uuid: " << mUuid << llendl;
151 llinfos << "creator: " << mCreatorID << llendl; 155 llinfos << "creator: " << mCreatorID << llendl;
152} 156}
@@ -314,6 +318,9 @@ LLAssetStorage::~LLAssetStorage()
314 // unregister our callbacks with the message system 318 // unregister our callbacks with the message system
315 gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, NULL, NULL); 319 gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, NULL, NULL);
316 } 320 }
321
322 // Clear the toxic asset map
323 mToxicAssetMap.clear();
317} 324}
318 325
319void LLAssetStorage::setUpstream(const LLHost &upstream_host) 326void LLAssetStorage::setUpstream(const LLHost &upstream_host)
@@ -1231,16 +1238,20 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
1231void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status) 1238void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status)
1232{ 1239{
1233 LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data; 1240 LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data;
1234 char filename[LL_MAX_PATH] = ""; /* Flawfinder: ignore */ 1241 std::string filename;
1242
1243 // Check if the asset is marked toxic, and don't load bad stuff
1244 BOOL toxic = gAssetStorage->isAssetToxic( uuid );
1235 1245
1236 if (! status) 1246 if ( !status
1247 && !toxic )
1237 { 1248 {
1238 LLVFile file(vfs, uuid, type); 1249 LLVFile file(vfs, uuid, type);
1239 1250
1240 char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ 1251 std::string uuid_str;
1241 1252
1242 uuid.toString(uuid_str); 1253 uuid.toString(uuid_str);
1243 snprintf(filename,sizeof(filename),"%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); /* Flawfinder: ignore */ 1254 filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type));
1244 1255
1245 LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ 1256 LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
1246 if (fp) 1257 if (fp)
@@ -1264,7 +1275,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss
1264 } 1275 }
1265 } 1276 }
1266 1277
1267 legacy->mDownCallback(filename, uuid, legacy->mUserData, status, ext_status); 1278 legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status);
1268 delete legacy; 1279 delete legacy;
1269} 1280}
1270 1281
@@ -1283,7 +1294,7 @@ void LLAssetStorage::storeAssetData(
1283{ 1294{
1284 llwarns << "storeAssetData: wrong version called" << llendl; 1295 llwarns << "storeAssetData: wrong version called" << llendl;
1285 // LLAssetStorage metric: Virtual base call 1296 // LLAssetStorage metric: Virtual base call
1286 reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); 1297 reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" );
1287} 1298}
1288 1299
1289// virtual 1300// virtual
@@ -1302,13 +1313,13 @@ void LLAssetStorage::storeAssetData(
1302{ 1313{
1303 llwarns << "storeAssetData: wrong version called" << llendl; 1314 llwarns << "storeAssetData: wrong version called" << llendl;
1304 // LLAssetStorage metric: Virtual base call 1315 // LLAssetStorage metric: Virtual base call
1305 reportMetric( asset_id, asset_type, NULL, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); 1316 reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" );
1306} 1317}
1307 1318
1308// virtual 1319// virtual
1309// this does nothing, viewer and sim both override this. 1320// this does nothing, viewer and sim both override this.
1310void LLAssetStorage::storeAssetData( 1321void LLAssetStorage::storeAssetData(
1311 const char* filename, 1322 const std::string& filename,
1312 const LLUUID& asset_id, 1323 const LLUUID& asset_id,
1313 LLAssetType::EType asset_type, 1324 LLAssetType::EType asset_type,
1314 LLStoreAssetCallback callback, 1325 LLStoreAssetCallback callback,
@@ -1320,13 +1331,13 @@ void LLAssetStorage::storeAssetData(
1320{ 1331{
1321 llwarns << "storeAssetData: wrong version called" << llendl; 1332 llwarns << "storeAssetData: wrong version called" << llendl;
1322 // LLAssetStorage metric: Virtual base call 1333 // LLAssetStorage metric: Virtual base call
1323 reportMetric( asset_id, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); 1334 reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" );
1324} 1335}
1325 1336
1326// virtual 1337// virtual
1327// this does nothing, viewer and sim both override this. 1338// this does nothing, viewer and sim both override this.
1328void LLAssetStorage::storeAssetData( 1339void LLAssetStorage::storeAssetData(
1329 const char* filename, 1340 const std::string& filename,
1330 const LLTransactionID &transactoin_id, 1341 const LLTransactionID &transactoin_id,
1331 LLAssetType::EType asset_type, 1342 LLAssetType::EType asset_type,
1332 LLStoreAssetCallback callback, 1343 LLStoreAssetCallback callback,
@@ -1338,7 +1349,7 @@ void LLAssetStorage::storeAssetData(
1338{ 1349{
1339 llwarns << "storeAssetData: wrong version called" << llendl; 1350 llwarns << "storeAssetData: wrong version called" << llendl;
1340 // LLAssetStorage metric: Virtual base call 1351 // LLAssetStorage metric: Virtual base call
1341 reportMetric( LLUUID::null, asset_type, NULL, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); 1352 reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" );
1342} 1353}
1343 1354
1344// static 1355// static
@@ -1385,9 +1396,9 @@ void LLAssetStorage::clearTempAssetData()
1385{ } 1396{ }
1386 1397
1387// static 1398// static
1388void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, 1399void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename,
1389 const LLUUID& agent_id, S32 asset_size, EMetricResult result, 1400 const LLUUID& agent_id, S32 asset_size, EMetricResult result,
1390 const char *file, const S32 line, const char *message ) 1401 const char *file, const S32 line, const std::string& in_message )
1391{ 1402{
1392 if( !metric_recipient ) 1403 if( !metric_recipient )
1393 { 1404 {
@@ -1395,18 +1406,13 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
1395 return; 1406 return;
1396 } 1407 }
1397 1408
1398 filename = filename ? filename : ""; 1409 std::string filename(in_filename);
1399 file = file ? file : ""; 1410 if (filename.empty())
1400 1411 filename = ll_safe_string(file);
1401 // Create revised message - message = "message :: file:line" 1412
1402 std::string new_message; //( message ); 1413 // Create revised message - new_message = "in_message :: file:line"
1403 new_message = message; // << " " << file << " " << line; 1414 std::stringstream new_message;
1404 new_message += " :: "; 1415 new_message << in_message << " :: " << filename << ":" << line;
1405 new_message += filename;
1406 char line_string[16];
1407 sprintf( line_string, ":%d", line );
1408 new_message += line_string;
1409 message = new_message.c_str();
1410 1416
1411 // Change always_report to true if debugging... do not check it in this way 1417 // Change always_report to true if debugging... do not check it in this way
1412 static bool always_report = false; 1418 static bool always_report = false;
@@ -1419,15 +1425,68 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
1419 LLSD stats; 1425 LLSD stats;
1420 stats["asset_id"] = asset_id; 1426 stats["asset_id"] = asset_id;
1421 stats["asset_type"] = asset_type; 1427 stats["asset_type"] = asset_type;
1422 stats["filename"] = filename? filename : ""; 1428 stats["filename"] = filename;
1423 stats["agent_id"] = agent_id; 1429 stats["agent_id"] = agent_id;
1424 stats["asset_size"] = (S32)asset_size; 1430 stats["asset_size"] = (S32)asset_size;
1425 stats["result"] = (S32)result; 1431 stats["result"] = (S32)result;
1426 1432
1427 metric_recipient->recordEventDetails( metric_name, message, success, stats); 1433 metric_recipient->recordEventDetails( metric_name, new_message.str(), success, stats);
1428 } 1434 }
1429 else 1435 else
1430 { 1436 {
1431 metric_recipient->recordEvent(metric_name, message, success); 1437 metric_recipient->recordEvent(metric_name, new_message.str(), success);
1438 }
1439}
1440
1441
1442// Check if an asset is in the toxic map. If it is, the entry is updated
1443BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid )
1444{
1445 BOOL is_toxic = FALSE;
1446
1447 if ( !uuid.isNull() )
1448 {
1449 toxic_asset_map_t::iterator iter = mToxicAssetMap.find( uuid );
1450 if ( iter != mToxicAssetMap.end() )
1451 { // Found toxic asset
1452 (*iter).second = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME;
1453 is_toxic = TRUE;
1454 }
1432 } 1455 }
1456 return is_toxic;
1433} 1457}
1458
1459
1460
1461
1462// Clean the toxic asset list, remove old entries
1463void LLAssetStorage::flushOldToxicAssets( BOOL force_it )
1464{
1465 // Scan and look for old entries
1466 U64 now = LLFrameTimer::getTotalTime();
1467 toxic_asset_map_t::iterator iter = mToxicAssetMap.begin();
1468 while ( iter != mToxicAssetMap.end() )
1469 {
1470 if ( force_it
1471 || (*iter).second < now )
1472 { // Too old - remove it
1473 mToxicAssetMap.erase( iter++ );
1474 }
1475 else
1476 {
1477 iter++;
1478 }
1479 }
1480}
1481
1482
1483// Add an item to the toxic asset map
1484void LLAssetStorage::markAssetToxic( const LLUUID& uuid )
1485{
1486 if ( !uuid.isNull() )
1487 {
1488 // Set the value to the current time. Creates a new entry if needed
1489 mToxicAssetMap[ uuid ] = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME;
1490 }
1491}
1492
diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h
index 739242a..86bf66a 100644
--- a/linden/indra/llmessage/llassetstorage.h
+++ b/linden/indra/llmessage/llassetstorage.h
@@ -197,7 +197,8 @@ public:
197}; 197};
198 198
199 199
200 200// Map of known bad assets
201typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t;
201 202
202typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, 203typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id,
203 LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); 204 LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status);
@@ -231,6 +232,9 @@ protected:
231 request_list_t mPendingUploads; 232 request_list_t mPendingUploads;
232 request_list_t mPendingLocalUploads; 233 request_list_t mPendingLocalUploads;
233 234
235 // Map of toxic assets - these caused problems when recently rezzed, so avoid them
236 toxic_asset_map_t mToxicAssetMap; // Objects in this list are known to cause problems and are not loaded
237
234public: 238public:
235 LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, 239 LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
236 LLVFS *vfs, const LLHost &upstream_host); 240 LLVFS *vfs, const LLHost &upstream_host);
@@ -291,6 +295,15 @@ public:
291 const LLUUID &asset_id, LLAssetType::EType atype, 295 const LLUUID &asset_id, LLAssetType::EType atype,
292 LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item. 296 LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item.
293 297
298 // Check if an asset is in the toxic map. If it is, the entry is updated
299 BOOL isAssetToxic( const LLUUID& uuid );
300
301 // Clean the toxic asset list, remove old entries
302 void flushOldToxicAssets( BOOL force_it );
303
304 // Add an item to the toxic asset map
305 void markAssetToxic( const LLUUID& uuid );
306
294protected: 307protected:
295 virtual LLSD getPendingDetails(const request_list_t* requests, 308 virtual LLSD getPendingDetails(const request_list_t* requests,
296 LLAssetType::EType asset_type, 309 LLAssetType::EType asset_type,
@@ -365,7 +378,7 @@ public:
365 * AssetID version. 378 * AssetID version.
366 */ 379 */
367 virtual void storeAssetData( 380 virtual void storeAssetData(
368 const char* filename, 381 const std::string& filename,
369 const LLUUID& asset_id, 382 const LLUUID& asset_id,
370 LLAssetType::EType type, 383 LLAssetType::EType type,
371 LLStoreAssetCallback callback, 384 LLStoreAssetCallback callback,
@@ -379,7 +392,7 @@ public:
379 * TransactionID version 392 * TransactionID version
380 */ 393 */
381 virtual void storeAssetData( 394 virtual void storeAssetData(
382 const char * filename, 395 const std::string& filename,
383 const LLTransactionID &transaction_id, 396 const LLTransactionID &transaction_id,
384 LLAssetType::EType type, 397 LLAssetType::EType type,
385 LLStoreAssetCallback callback, 398 LLStoreAssetCallback callback,
@@ -438,9 +451,9 @@ protected:
438 451
439 static class LLMetrics *metric_recipient; 452 static class LLMetrics *metric_recipient;
440 453
441 static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const char *filename, 454 static void reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& filename,
442 const LLUUID& agent_id, S32 asset_size, EMetricResult result, 455 const LLUUID& agent_id, S32 asset_size, EMetricResult result,
443 const char *file, const S32 line, const char *message ); 456 const char* file, const S32 line, const std::string& message );
444public: 457public:
445 static void setMetricRecipient( LLMetrics *recip ) 458 static void setMetricRecipient( LLMetrics *recip )
446 { 459 {
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 9adf10d..70e1ccf 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -43,10 +43,9 @@
43#include "message.h" 43#include "message.h"
44 44
45// Constants 45// Constants
46// probably need a setUIString() call in the interface 46static const std::string CN_WAITING("(Loading...)"); // *TODO: translate
47const char* const CN_WAITING = "(Loading...)"; // *TODO: translate 47static const std::string CN_NOBODY("(nobody)"); // *TODO: translate
48const char* const CN_NOBODY = "(nobody)"; // *TODO: translate 48static const std::string CN_NONE("(none)"); // *TODO: translate
49const char* const CN_NONE = "(none)"; // *TODO: translate
50 49
51// llsd serialization constants 50// llsd serialization constants
52static const std::string AGENTS("agents"); 51static const std::string AGENTS("agents");
@@ -78,16 +77,13 @@ public:
78public: 77public:
79 bool mIsGroup; 78 bool mIsGroup;
80 U32 mCreateTime; // unix time_t 79 U32 mCreateTime; // unix time_t
81 char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 80 std::string mFirstName;
82 char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 81 std::string mLastName;
83 char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 82 std::string mGroupName;
84}; 83};
85 84
86LLCacheNameEntry::LLCacheNameEntry() 85LLCacheNameEntry::LLCacheNameEntry()
87{ 86{
88 mFirstName[0] = '\0';
89 mLastName[0] = '\0';
90 mGroupName[0] = '\0';
91} 87}
92 88
93 89
@@ -235,7 +231,7 @@ public:
235 static void handleUUIDGroupNameRequest(LLMessageSystem* msg, void** userdata); 231 static void handleUUIDGroupNameRequest(LLMessageSystem* msg, void** userdata);
236 static void handleUUIDGroupNameReply(LLMessageSystem* msg, void** userdata); 232 static void handleUUIDGroupNameReply(LLMessageSystem* msg, void** userdata);
237 233
238 void notifyObservers(const LLUUID& id, const char* first, const char* last, BOOL group); 234 void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group);
239}; 235};
240 236
241 237
@@ -390,8 +386,8 @@ void LLCacheName::importFile(LLFILE* fp)
390 LLCacheNameEntry* entry = new LLCacheNameEntry(); 386 LLCacheNameEntry* entry = new LLCacheNameEntry();
391 entry->mIsGroup = false; 387 entry->mIsGroup = false;
392 entry->mCreateTime = create_time; 388 entry->mCreateTime = create_time;
393 LLString::copy(entry->mFirstName, firstname, DB_FIRST_NAME_BUF_SIZE); 389 entry->mFirstName = firstname;
394 LLString::copy(entry->mLastName, lastname, DB_LAST_NAME_BUF_SIZE); 390 entry->mLastName = lastname;
395 impl.mCache[id] = entry; 391 impl.mCache[id] = entry;
396 392
397 count++; 393 count++;
@@ -426,12 +422,8 @@ bool LLCacheName::importFile(std::istream& istr)
426 LLCacheNameEntry* entry = new LLCacheNameEntry(); 422 LLCacheNameEntry* entry = new LLCacheNameEntry();
427 entry->mIsGroup = false; 423 entry->mIsGroup = false;
428 entry->mCreateTime = ctime; 424 entry->mCreateTime = ctime;
429 std::string first = agent[FIRST].asString(); 425 entry->mFirstName = agent[FIRST].asString();
430 first.copy(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE, 0); 426 entry->mLastName = agent[LAST].asString();
431 entry->mFirstName[llmin(first.size(),(std::string::size_type)DB_FIRST_NAME_BUF_SIZE-1)] = '\0';
432 std::string last = agent[LAST].asString();
433 last.copy(entry->mLastName, DB_LAST_NAME_BUF_SIZE, 0);
434 entry->mLastName[llmin(last.size(),(std::string::size_type)DB_LAST_NAME_BUF_SIZE-1)] = '\0';
435 impl.mCache[id] = entry; 427 impl.mCache[id] = entry;
436 ++count; 428 ++count;
437 } 429 }
@@ -451,9 +443,7 @@ bool LLCacheName::importFile(std::istream& istr)
451 LLCacheNameEntry* entry = new LLCacheNameEntry(); 443 LLCacheNameEntry* entry = new LLCacheNameEntry();
452 entry->mIsGroup = true; 444 entry->mIsGroup = true;
453 entry->mCreateTime = ctime; 445 entry->mCreateTime = ctime;
454 std::string name = group[NAME].asString(); 446 entry->mGroupName = group[NAME].asString();
455 name.copy(entry->mGroupName, DB_GROUP_NAME_BUF_SIZE, 0);
456 entry->mGroupName[llmin(name.size(), (std::string::size_type)DB_GROUP_NAME_BUF_SIZE-1)] = '\0';
457 impl.mCache[id] = entry; 447 impl.mCache[id] = entry;
458 ++count; 448 ++count;
459 } 449 }
@@ -471,8 +461,8 @@ void LLCacheName::exportFile(std::ostream& ostr)
471 // Only write entries for which we have valid data. 461 // Only write entries for which we have valid data.
472 LLCacheNameEntry* entry = iter->second; 462 LLCacheNameEntry* entry = iter->second;
473 if(!entry 463 if(!entry
474 || (NULL != strchr(entry->mFirstName, '?')) 464 || (std::string::npos != entry->mFirstName.find('?'))
475 || (NULL != strchr(entry->mGroupName, '?'))) 465 || (std::string::npos != entry->mGroupName.find('?')))
476 { 466 {
477 continue; 467 continue;
478 } 468 }
@@ -480,13 +470,13 @@ void LLCacheName::exportFile(std::ostream& ostr)
480 // store it 470 // store it
481 LLUUID id = iter->first; 471 LLUUID id = iter->first;
482 std::string id_str = id.asString(); 472 std::string id_str = id.asString();
483 if(entry->mFirstName[0] && entry->mLastName[0]) 473 if(!entry->mFirstName.empty() && !entry->mLastName.empty())
484 { 474 {
485 data[AGENTS][id_str][FIRST] = entry->mFirstName; 475 data[AGENTS][id_str][FIRST] = entry->mFirstName;
486 data[AGENTS][id_str][LAST] = entry->mLastName; 476 data[AGENTS][id_str][LAST] = entry->mLastName;
487 data[AGENTS][id_str][CTIME] = (S32)entry->mCreateTime; 477 data[AGENTS][id_str][CTIME] = (S32)entry->mCreateTime;
488 } 478 }
489 else if(entry->mIsGroup && entry->mGroupName[0]) 479 else if(entry->mIsGroup && !entry->mGroupName.empty())
490 { 480 {
491 data[GROUPS][id_str][NAME] = entry->mGroupName; 481 data[GROUPS][id_str][NAME] = entry->mGroupName;
492 data[GROUPS][id_str][CTIME] = (S32)entry->mCreateTime; 482 data[GROUPS][id_str][CTIME] = (S32)entry->mCreateTime;
@@ -534,16 +524,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
534 return res; 524 return res;
535} 525}
536 526
537// *TODO: Deprecate
538BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
539{
540 std::string first_name, last_name;
541 BOOL res = getName(id, first_name, last_name);
542 strcpy(first, first_name.c_str());
543 strcpy(last, last_name.c_str());
544 return res;
545}
546
547BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) 527BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
548{ 528{
549 if(id.isNull()) 529 if(id.isNull())
@@ -553,7 +533,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
553 } 533 }
554 534
555 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); 535 LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id);
556 if (entry && !entry->mGroupName[0]) 536 if (entry && entry->mGroupName.empty())
557 { 537 {
558 // COUNTER-HACK to combat James' HACK in exportFile()... 538 // COUNTER-HACK to combat James' HACK in exportFile()...
559 // this group name was loaded from a name cache that did not 539 // this group name was loaded from a name cache that did not
@@ -578,16 +558,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
578 } 558 }
579} 559}
580 560
581// *TODO: Deprecate
582BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
583{
584 std::string group_name;
585 BOOL res = getGroupName(id, group_name);
586 strcpy(group, group_name.c_str());
587 return res;
588}
589
590
591// TODO: Make the cache name callback take a SINGLE std::string, 561// TODO: Make the cache name callback take a SINGLE std::string,
592// not a separate first and last name. 562// not a separate first and last name.
593void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data) 563void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data)
@@ -716,9 +686,9 @@ void LLCacheName::dumpStats()
716} 686}
717 687
718//static 688//static
719LLString LLCacheName::getDefaultName() 689std::string LLCacheName::getDefaultName()
720{ 690{
721 return LLString(CN_WAITING); 691 return CN_WAITING;
722} 692}
723 693
724void LLCacheName::Impl::processPendingAsks() 694void LLCacheName::Impl::processPendingAsks()
@@ -813,7 +783,7 @@ void LLCacheName::Impl::sendRequest(
813} 783}
814 784
815void LLCacheName::Impl::notifyObservers(const LLUUID& id, 785void LLCacheName::Impl::notifyObservers(const LLUUID& id,
816 const char* first, const char* last, BOOL is_group) 786 const std::string& first, const std::string& last, BOOL is_group)
817{ 787{
818 for (Observers::const_iterator i = mObservers.begin(), 788 for (Observers::const_iterator i = mObservers.begin(),
819 end = mObservers.end(); 789 end = mObservers.end();
@@ -917,19 +887,17 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup)
917 entry->mCreateTime = (U32)time(NULL); 887 entry->mCreateTime = (U32)time(NULL);
918 if (!isGroup) 888 if (!isGroup)
919 { 889 {
920 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, DB_FIRST_NAME_BUF_SIZE, entry->mFirstName, i); 890 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i);
921 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, DB_LAST_NAME_BUF_SIZE, entry->mLastName, i); 891 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i);
922 } 892 }
923 else 893 else
924 { 894 {
925 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, DB_GROUP_NAME_BUF_SIZE, entry->mGroupName, i); 895 msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i);
926 } 896 }
927 897
928 if (!isGroup) 898 if (!isGroup)
929 { 899 {
930 notifyObservers(id, 900 notifyObservers(id, entry->mFirstName, entry->mLastName, FALSE);
931 entry->mFirstName, entry->mLastName,
932 FALSE);
933 } 901 }
934 else 902 else
935 { 903 {
diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h
index e7d5a44..965b4ba 100644
--- a/linden/indra/llmessage/llcachename.h
+++ b/linden/indra/llmessage/llcachename.h
@@ -37,7 +37,7 @@ class LLHost;
37class LLUUID; 37class LLUUID;
38 38
39// agent_id/group_id, first_name, last_name, is_group, user_data 39// agent_id/group_id, first_name, last_name, is_group, user_data
40typedef void (*LLCacheNameCallback)(const LLUUID&, const char*, const char*, BOOL, void*); 40typedef void (*LLCacheNameCallback)(const LLUUID&, const std::string&, const std::string&, BOOL, void*);
41 41
42// Here's the theory: 42// Here's the theory:
43// If you request a name that isn't in the cache, it returns "waiting" 43// If you request a name that isn't in the cache, it returns "waiting"
@@ -75,7 +75,6 @@ public:
75 // last must be at least DB_LAST_NAME_BUF_SIZE characters. 75 // last must be at least DB_LAST_NAME_BUF_SIZE characters.
76 // If not available, copies the string "waiting". 76 // If not available, copies the string "waiting".
77 // Returns TRUE iff available. 77 // Returns TRUE iff available.
78 BOOL getName(const LLUUID& id, char* first, char* last);
79 BOOL getName(const LLUUID& id, std::string& first, std::string& last); 78 BOOL getName(const LLUUID& id, std::string& first, std::string& last);
80 BOOL getFullName(const LLUUID& id, std::string& fullname); 79 BOOL getFullName(const LLUUID& id, std::string& fullname);
81 80
@@ -83,7 +82,6 @@ public:
83 // provided. The caller must allocate at least 82 // provided. The caller must allocate at least
84 // DB_GROUP_NAME_BUF_SIZE characters. If not available, this 83 // DB_GROUP_NAME_BUF_SIZE characters. If not available, this
85 // method copies the string "waiting". Returns TRUE iff available. 84 // method copies the string "waiting". Returns TRUE iff available.
86 BOOL getGroupName(const LLUUID& id, char* group);
87 BOOL getGroupName(const LLUUID& id, std::string& group); 85 BOOL getGroupName(const LLUUID& id, std::string& group);
88 86
89 // Call the callback with the group or avatar name. 87 // Call the callback with the group or avatar name.
@@ -107,7 +105,7 @@ public:
107 void dump(); // Dumps the contents of the cache 105 void dump(); // Dumps the contents of the cache
108 void dumpStats(); // Dumps the sizes of the cache and associated queues. 106 void dumpStats(); // Dumps the sizes of the cache and associated queues.
109 107
110 static LLString getDefaultName(); 108 static std::string getDefaultName();
111 109
112private: 110private:
113 111
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index 7b369cb..12a1520 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -184,7 +184,7 @@ LLCircuitData::~LLCircuitData()
184 std::ostream_iterator<TPACKETID> append(str, " "); 184 std::ostream_iterator<TPACKETID> append(str, " ");
185 str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t"; 185 str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t";
186 std::copy(doomed.begin(), doomed.end(), append); 186 std::copy(doomed.begin(), doomed.end(), append);
187 llinfos << str.str().c_str() << llendl; 187 llinfos << str.str() << llendl;
188 } 188 }
189} 189}
190 190
@@ -204,7 +204,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
204 std::ostringstream str; 204 std::ostringstream str;
205 str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" 205 str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t"
206 << packetp->mPacketID; 206 << packetp->mPacketID;
207 llinfos << str.str().c_str() << llendl; 207 llinfos << str.str() << llendl;
208 } 208 }
209 if (packetp->mCallback) 209 if (packetp->mCallback)
210 { 210 {
@@ -238,7 +238,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num)
238 std::ostringstream str; 238 std::ostringstream str;
239 str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" 239 str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t"
240 << packetp->mPacketID; 240 << packetp->mPacketID;
241 llinfos << str.str().c_str() << llendl; 241 llinfos << str.str() << llendl;
242 } 242 }
243 if (packetp->mCallback) 243 if (packetp->mCallback)
244 { 244 {
@@ -342,7 +342,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
342 std::ostringstream str; 342 std::ostringstream str;
343 str << "MSG: -> " << packetp->mHost 343 str << "MSG: -> " << packetp->mHost
344 << "\tRESENDING RELIABLE:\t" << packetp->mPacketID; 344 << "\tRESENDING RELIABLE:\t" << packetp->mPacketID;
345 llinfos << str.str().c_str() << llendl; 345 llinfos << str.str() << llendl;
346 } 346 }
347 347
348 packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend 348 packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend
@@ -403,7 +403,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
403 std::ostringstream str; 403 std::ostringstream str;
404 str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t" 404 str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t"
405 << packetp->mPacketID; 405 << packetp->mPacketID;
406 llinfos << str.str().c_str() << llendl; 406 llinfos << str.str() << llendl;
407 } 407 }
408 408
409 if (packetp->mCallback) 409 if (packetp->mCallback)
@@ -710,7 +710,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
710 { 710 {
711 std::ostringstream str; 711 std::ostringstream str;
712 str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id; 712 str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id;
713 llinfos << str.str().c_str() << llendl; 713 llinfos << str.str() << llendl;
714 } 714 }
715 // llinfos << "removing potential lost: " << id << llendl; 715 // llinfos << "removing potential lost: " << id << llendl;
716 mPotentialLostPackets.erase(id); 716 mPotentialLostPackets.erase(id);
@@ -729,7 +729,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
729 std::ostringstream str; 729 std::ostringstream str;
730 str << "MSG: <- " << mHost << "\tPACKET GAP:\t" 730 str << "MSG: <- " << mHost << "\tPACKET GAP:\t"
731 << index; 731 << index;
732 llinfos << str.str().c_str() << llendl; 732 llinfos << str.str() << llendl;
733 } 733 }
734 734
735// llinfos << "adding potential lost: " << index << llendl; 735// llinfos << "adding potential lost: " << index << llendl;
@@ -747,7 +747,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
747 std::ostringstream str; 747 std::ostringstream str;
748 str << "MSG: <- " << mHost << "\tPACKET GAP:\t" 748 str << "MSG: <- " << mHost << "\tPACKET GAP:\t"
749 << id << " expected " << index; 749 << id << " expected " << index;
750 llinfos << str.str().c_str() << llendl; 750 llinfos << str.str() << llendl;
751 } 751 }
752 } 752 }
753 753
@@ -969,7 +969,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys)
969 std::ostringstream str; 969 std::ostringstream str;
970 str << "MSG: <- " << mHost << "\tLOST PACKET:\t" 970 str << "MSG: <- " << mHost << "\tLOST PACKET:\t"
971 << (*it).first; 971 << (*it).first;
972 llinfos << str.str().c_str() << llendl; 972 llinfos << str.str() << llendl;
973 } 973 }
974 mPotentialLostPackets.erase(it++); 974 mPotentialLostPackets.erase(it++);
975 } 975 }
@@ -1114,7 +1114,7 @@ void LLCircuit::sendAcks()
1114 str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t"; 1114 str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t";
1115 std::ostream_iterator<TPACKETID> append(str, " "); 1115 std::ostream_iterator<TPACKETID> append(str, " ");
1116 std::copy(cd->mAcks.begin(), cd->mAcks.end(), append); 1116 std::copy(cd->mAcks.begin(), cd->mAcks.end(), append);
1117 llinfos << str.str().c_str() << llendl; 1117 llinfos << str.str() << llendl;
1118 } 1118 }
1119 1119
1120 // empty out the acks list 1120 // empty out the acks list
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
105std::string LLCurl::getVersionString()
106{
107 return std::string(curl_version());
108}
109
104////////////////////////////////////////////////////////////////////////////// 110//////////////////////////////////////////////////////////////////////////////
105 111
106LLCurl::Responder::Responder() 112LLCurl::Responder::Responder()
@@ -113,6 +119,15 @@ LLCurl::Responder::~Responder()
113} 119}
114 120
115// virtual 121// virtual
122void LLCurl::Responder::error(
123 U32 status,
124 const std::string& reason,
125 const LLSD&)
126{
127 error(status, reason);
128}
129
130// virtual
116void LLCurl::Responder::error(U32 status, const std::string& reason) 131void 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
127void LLCurl::Responder::completedRaw(U32 status, const std::string& reason, 142void 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
287void LLCurl::Easy::resetState() 280void 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();
diff --git a/linden/indra/llmessage/llcurl.h b/linden/indra/llmessage/llcurl.h
index 2737f6e..0c2caad 100644
--- a/linden/indra/llmessage/llcurl.h
+++ b/linden/indra/llmessage/llcurl.h
@@ -84,17 +84,31 @@ public:
84 return((200 <= status) && (status < 300)); 84 return((200 <= status) && (status < 300));
85 } 85 }
86 86
87 virtual void error(
88 U32 status,
89 const std::string& reason,
90 const LLSD& content);
91 //< called by completed() on bad status
92
87 virtual void error(U32 status, const std::string& reason); 93 virtual void error(U32 status, const std::string& reason);
88 // called with non-200 status codes 94 //< called by default error(status, reason, content)
89 95
90 virtual void result(const LLSD& content); 96 virtual void result(const LLSD& content);
91 97 //< called by completed for good status codes.
92 // Override point for clients that may want to use this class when the response is some other format besides LLSD 98
93 virtual void completedRaw(U32 status, const std::string& reason, 99 virtual void completedRaw(
94 const LLChannelDescriptors& channels, 100 U32 status,
95 const LLIOPipe::buffer_ptr_t& buffer); 101 const std::string& reason,
102 const LLChannelDescriptors& channels,
103 const LLIOPipe::buffer_ptr_t& buffer);
104 /**< Override point for clients that may want to use this
105 class when the response is some other format besides LLSD
106 */
96 107
97 virtual void completed(U32 status, const std::string& reason, const LLSD& content); 108 virtual void completed(
109 U32 status,
110 const std::string& reason,
111 const LLSD& content);
98 /**< The default implemetnation calls 112 /**< The default implemetnation calls
99 either: 113 either:
100 * result(), or 114 * result(), or
@@ -120,6 +134,11 @@ public:
120 * @ brief Set certificate authority path used to verify HTTPS certs. 134 * @ brief Set certificate authority path used to verify HTTPS certs.
121 */ 135 */
122 static void setCAPath(const std::string& path); 136 static void setCAPath(const std::string& path);
137
138 /**
139 * @ brief Return human-readable string describing libcurl version.
140 */
141 static std::string getVersionString();
123 142
124 /** 143 /**
125 * @ brief Get certificate authority file used to verify HTTPS certs. 144 * @ brief Get certificate authority file used to verify HTTPS certs.
diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp
index ec198f7..2c7c036 100644
--- a/linden/indra/llmessage/lldatapacker.cpp
+++ b/linden/indra/llmessage/lldatapacker.cpp
@@ -170,16 +170,16 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
170// LLDataPackerBinaryBuffer implementation 170// LLDataPackerBinaryBuffer implementation
171//--------------------------------------------------------------------------- 171//---------------------------------------------------------------------------
172 172
173BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) 173BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name)
174{ 174{
175 BOOL success = TRUE; 175 BOOL success = TRUE;
176 S32 length = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ 176 S32 length = value.length()+1;
177 177
178 success &= verifyLength(length, name); 178 success &= verifyLength(length, name);
179 179
180 if (mWriteEnabled) 180 if (mWriteEnabled)
181 { 181 {
182 htonmemcpy(mCurBufferp, value, MVT_VARIABLE, length); 182 htonmemcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length);
183 } 183 }
184 mCurBufferp += length; 184 mCurBufferp += length;
185 return success; 185 return success;
@@ -577,18 +577,18 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog()
577//--------------------------------------------------------------------------- 577//---------------------------------------------------------------------------
578// LLDataPackerAsciiBuffer implementation 578// LLDataPackerAsciiBuffer implementation
579//--------------------------------------------------------------------------- 579//---------------------------------------------------------------------------
580BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) 580BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name)
581{ 581{
582 BOOL success = TRUE; 582 BOOL success = TRUE;
583 writeIndentedName(name); 583 writeIndentedName(name);
584 int numCopied = 0; 584 int numCopied = 0;
585 if (mWriteEnabled) 585 if (mWriteEnabled)
586 { 586 {
587 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value); /* Flawfinder: ignore */ 587 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value.c_str()); /* Flawfinder: ignore */
588 } 588 }
589 else 589 else
590 { 590 {
591 numCopied = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ 591 numCopied = value.length() + 1; /*Flawfinder: ignore*/
592 } 592 }
593 593
594 // snprintf returns number of bytes that would have been written 594 // snprintf returns number of bytes that would have been written
@@ -1242,9 +1242,9 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name)
1242 int numCopied = 0; 1242 int numCopied = 0;
1243 if (mWriteEnabled) 1243 if (mWriteEnabled)
1244 { 1244 {
1245 char tmp_str[64]; /* Flawfinder: ignore */ 1245 std::string tmp_str;
1246 value.toString(tmp_str); 1246 value.toString(tmp_str);
1247 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */ 1247 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str.c_str()); /* Flawfinder: ignore */
1248 } 1248 }
1249 else 1249 else
1250 { 1250 {
@@ -1376,13 +1376,13 @@ std::string convertF32ToString(F32 val)
1376//--------------------------------------------------------------------------- 1376//---------------------------------------------------------------------------
1377// LLDataPackerAsciiFile implementation 1377// LLDataPackerAsciiFile implementation
1378//--------------------------------------------------------------------------- 1378//---------------------------------------------------------------------------
1379BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) 1379BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name)
1380{ 1380{
1381 BOOL success = TRUE; 1381 BOOL success = TRUE;
1382 writeIndentedName(name); 1382 writeIndentedName(name);
1383 if (mFP) 1383 if (mFP)
1384 { 1384 {
1385 fprintf(mFP,"%s\n", value); 1385 fprintf(mFP,"%s\n", value.c_str());
1386 } 1386 }
1387 else if (mOutputStream) 1387 else if (mOutputStream)
1388 { 1388 {
@@ -1829,11 +1829,11 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name)
1829{ 1829{
1830 BOOL success = TRUE; 1830 BOOL success = TRUE;
1831 writeIndentedName(name); 1831 writeIndentedName(name);
1832 char tmp_str[64]; /*Flawfinder: ignore */ 1832 std::string tmp_str;
1833 value.toString(tmp_str); 1833 value.toString(tmp_str);
1834 if (mFP) 1834 if (mFP)
1835 { 1835 {
1836 fprintf(mFP,"%s\n", tmp_str); 1836 fprintf(mFP,"%s\n", tmp_str.c_str());
1837 } 1837 }
1838 else if (mOutputStream) 1838 else if (mOutputStream)
1839 { 1839 {
@@ -1877,7 +1877,7 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name)
1877 } 1877 }
1878 else if (mOutputStream) 1878 else if (mOutputStream)
1879 { 1879 {
1880 *mOutputStream << indent_buf.c_str() << name << "\t"; 1880 *mOutputStream << indent_buf << name << "\t";
1881 } 1881 }
1882} 1882}
1883 1883
diff --git a/linden/indra/llmessage/lldatapacker.h b/linden/indra/llmessage/lldatapacker.h
index b1aa8fe..47dee99 100644
--- a/linden/indra/llmessage/lldatapacker.h
+++ b/linden/indra/llmessage/lldatapacker.h
@@ -49,7 +49,7 @@ public:
49 49
50 virtual BOOL hasNext() const = 0; 50 virtual BOOL hasNext() const = 0;
51 51
52 virtual BOOL packString(const char *value, const char *name) = 0; 52 virtual BOOL packString(const std::string& value, const char *name) = 0;
53 virtual BOOL unpackString(std::string& value, const char *name) = 0; 53 virtual BOOL unpackString(std::string& value, const char *name) = 0;
54 54
55 virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; 55 virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0;
@@ -127,7 +127,7 @@ public:
127 { 127 {
128 } 128 }
129 129
130 /*virtual*/ BOOL packString(const char *value, const char *name); 130 /*virtual*/ BOOL packString(const std::string& value, const char *name);
131 /*virtual*/ BOOL unpackString(std::string& value, const char *name); 131 /*virtual*/ BOOL unpackString(std::string& value, const char *name);
132 132
133 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); 133 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name);
@@ -229,7 +229,7 @@ public:
229 mWriteEnabled = FALSE; 229 mWriteEnabled = FALSE;
230 } 230 }
231 231
232 /*virtual*/ BOOL packString(const char *value, const char *name); 232 /*virtual*/ BOOL packString(const std::string& value, const char *name);
233 /*virtual*/ BOOL unpackString(std::string& value, const char *name); 233 /*virtual*/ BOOL unpackString(std::string& value, const char *name);
234 234
235 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); 235 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name);
@@ -358,7 +358,7 @@ public:
358 { 358 {
359 } 359 }
360 360
361 /*virtual*/ BOOL packString(const char *value, const char *name); 361 /*virtual*/ BOOL packString(const std::string& value, const char *name);
362 /*virtual*/ BOOL unpackString(std::string& value, const char *name); 362 /*virtual*/ BOOL unpackString(std::string& value, const char *name);
363 363
364 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); 364 /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name);
diff --git a/linden/indra/llmessage/lldispatcher.cpp b/linden/indra/llmessage/lldispatcher.cpp
index 0270721..541da42 100644
--- a/linden/indra/llmessage/lldispatcher.cpp
+++ b/linden/indra/llmessage/lldispatcher.cpp
@@ -111,8 +111,7 @@ bool LLDispatcher::unpackMessage(
111 LLDispatcher::sparam_t& parameters) 111 LLDispatcher::sparam_t& parameters)
112{ 112{
113 char buf[MAX_STRING]; /*Flawfinder: ignore*/ 113 char buf[MAX_STRING]; /*Flawfinder: ignore*/
114 msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, MAX_STRING, buf); 114 msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method);
115 method.assign(buf);
116 msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); 115 msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice);
117 S32 size; 116 S32 size;
118 S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); 117 S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList);
diff --git a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
index b3ebd0b..a3c33dd 100644
--- a/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
+++ b/linden/indra/llmessage/llfiltersd2xmlrpc.cpp
@@ -81,7 +81,7 @@
81#include <sstream> 81#include <sstream>
82#include <iterator> 82#include <iterator>
83#include <xmlrpc-epi/xmlrpc.h> 83#include <xmlrpc-epi/xmlrpc.h>
84#include "apr-1/apr_base64.h" 84#include "apr_base64.h"
85 85
86#include "llbuffer.h" 86#include "llbuffer.h"
87#include "llbufferstream.h" 87#include "llbufferstream.h"
diff --git a/linden/indra/llmessage/llhost.cpp b/linden/indra/llmessage/llhost.cpp
index e139f6d..34a0f92 100644
--- a/linden/indra/llmessage/llhost.cpp
+++ b/linden/indra/llmessage/llhost.cpp
@@ -66,34 +66,15 @@ LLHost::LLHost(const std::string& ip_and_port)
66 } 66 }
67} 67}
68 68
69void LLHost::getString(char* buffer, S32 length) const 69std::string LLHost::getString() const
70{ 70{
71 if (((U32) length) < MAXADDRSTR + 1 + 5) 71 return llformat("%s:%u", u32_to_ip_string(mIP), mPort);
72 {
73 llerrs << "LLHost::getString - string too short" << llendl;
74 return;
75 }
76
77 snprintf(buffer, length, "%s:%u", u32_to_ip_string(mIP), mPort); /* Flawfinder: ignore */
78}
79
80void LLHost::getIPString(char* buffer, S32 length) const
81{
82 if ( ((U32) length) < MAXADDRSTR)
83 {
84 llerrs << "LLHost::getIPString - string too short" << llendl;
85 return;
86 }
87
88 snprintf(buffer, length, "%s", u32_to_ip_string(mIP)); /* Flawfinder: ignore */
89} 72}
90 73
91 74
92std::string LLHost::getIPandPort() const 75std::string LLHost::getIPandPort() const
93{ 76{
94 char buffer[MAXADDRSTR + 1 + 5]; /*Flawfinder: ignore*/ 77 return getString();
95 getString(buffer, sizeof(buffer));
96 return buffer;
97} 78}
98 79
99 80
@@ -103,35 +84,6 @@ std::string LLHost::getIPString() const
103} 84}
104 85
105 86
106void LLHost::getHostName(char *buf, S32 len) const
107{
108 hostent *he;
109
110 if (INVALID_HOST_IP_ADDRESS == mIP)
111 {
112 llwarns << "LLHost::getHostName() : Invalid IP address" << llendl;
113 buf[0] = '\0';
114 return;
115 }
116 he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET);
117 if (!he)
118 {
119#if LL_WINDOWS
120 llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
121 << WSAGetLastError() << llendl;
122#else
123 llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
124 << h_errno << llendl;
125#endif
126 buf[0] = '\0';
127 }
128 else
129 {
130 strncpy(buf, he->h_name, len); /*Flawfinder: ignore*/
131 buf[len-1] = '\0';
132 }
133}
134
135std::string LLHost::getHostName() const 87std::string LLHost::getHostName() const
136{ 88{
137 hostent* he; 89 hostent* he;
@@ -158,28 +110,20 @@ std::string LLHost::getHostName() const
158 } 110 }
159} 111}
160 112
161BOOL LLHost::setHostByName(const char *string) 113BOOL LLHost::setHostByName(const std::string& hostname)
162{ 114{
163 hostent *he; 115 hostent *he;
164 char local_name[MAX_STRING]; /*Flawfinder: ignore*/ 116 std::string local_name(hostname);
165
166 if (strlen(string)+1 > MAX_STRING) /*Flawfinder: ignore*/
167 {
168 llerrs << "LLHost::setHostByName() : Address string is too long: "
169 << string << llendl;
170 }
171 117
172 strncpy(local_name, string,MAX_STRING); /*Flawfinder: ignore*/
173 local_name[MAX_STRING-1] = '\0';
174#if LL_WINDOWS 118#if LL_WINDOWS
175 // We may need an equivalent for Linux, but not sure - djs 119 // We may need an equivalent for Linux, but not sure - djs
176 _strupr(local_name); 120 LLStringUtil::toUpper(local_name);
177#endif 121#endif
178 122
179 he = gethostbyname(local_name); 123 he = gethostbyname(local_name.c_str());
180 if(!he) 124 if(!he)
181 { 125 {
182 U32 ip_address = inet_addr(string); 126 U32 ip_address = inet_addr(hostname.c_str());
183 he = gethostbyaddr((char *)&ip_address, sizeof(ip_address), AF_INET); 127 he = gethostbyaddr((char *)&ip_address, sizeof(ip_address), AF_INET);
184 } 128 }
185 129
diff --git a/linden/indra/llmessage/llhost.h b/linden/indra/llmessage/llhost.h
index 0b3afe8..819e7ca 100644
--- a/linden/indra/llmessage/llhost.h
+++ b/linden/indra/llmessage/llhost.h
@@ -61,10 +61,10 @@ public:
61 mIP = ipv4_addr; 61 mIP = ipv4_addr;
62 } 62 }
63 63
64 LLHost( const char *ipv4_addr, U32 port ) 64 LLHost( const std::string& ipv4_addr, U32 port )
65 : mPort( port ) 65 : mPort( port )
66 { 66 {
67 mIP = ip_string_to_u32(ipv4_addr); 67 mIP = ip_string_to_u32(ipv4_addr.c_str());
68 } 68 }
69 69
70 explicit LLHost(const U64 ip_port) 70 explicit LLHost(const U64 ip_port)
@@ -82,11 +82,11 @@ public:
82 82
83 // MANIPULATORS 83 // MANIPULATORS
84 void set( U32 ip, U32 port ) { mIP = ip; mPort = port; } 84 void set( U32 ip, U32 port ) { mIP = ip; mPort = port; }
85 void set( const char* ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr); mPort = port; } 85 void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; }
86 void setAddress( const char* ipstr ) { mIP = ip_string_to_u32(ipstr); } 86 void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); }
87 void setAddress( U32 ip ) { mIP = ip; } 87 void setAddress( U32 ip ) { mIP = ip; }
88 void setPort( U32 port ) { mPort = port; } 88 void setPort( U32 port ) { mPort = port; }
89 BOOL setHostByName(const char *hname); 89 BOOL setHostByName(const std::string& hname);
90 90
91 LLHost& operator=(const LLHost &rhs); 91 LLHost& operator=(const LLHost &rhs);
92 void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; 92 void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;};
@@ -96,10 +96,8 @@ public:
96 U32 getPort() const { return mPort; } 96 U32 getPort() const { return mPort; }
97 BOOL isOk() const { return (mIP != INVALID_HOST_IP_ADDRESS) && (mPort != INVALID_PORT); } 97 BOOL isOk() const { return (mIP != INVALID_HOST_IP_ADDRESS) && (mPort != INVALID_PORT); }
98 size_t hash() const { return (mIP << 16) | (mPort & 0xffff); } 98 size_t hash() const { return (mIP << 16) | (mPort & 0xffff); }
99 void getString(char* buffer, S32 length) const; // writes IP:port into buffer 99 std::string getString() const;
100 void getIPString(char* buffer, S32 length) const; // writes IP into buffer
101 std::string getIPString() const; 100 std::string getIPString() const;
102 void getHostName(char *buf, S32 len) const;
103 std::string getHostName() const; 101 std::string getHostName() const;
104 std::string getIPandPort() const; 102 std::string getIPandPort() const;
105 103
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index 49896c6..fdd521f 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -81,8 +81,8 @@ class LLHTTPAssetRequest : public LLAssetRequest
81{ 81{
82public: 82public:
83 LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid, 83 LLHTTPAssetRequest(LLHTTPAssetStorage *asp, const LLUUID &uuid,
84 LLAssetType::EType type, LLAssetStorage::ERequestType rt, 84 LLAssetType::EType type, LLAssetStorage::ERequestType rt,
85 const char *url, CURLM *curl_multi); 85 const std::string& url, CURLM *curl_multi);
86 virtual ~LLHTTPAssetRequest(); 86 virtual ~LLHTTPAssetRequest();
87 87
88 void setupCurlHandle(); 88 void setupCurlHandle();
@@ -103,7 +103,7 @@ public:
103 103
104 CURL *mCurlHandle; 104 CURL *mCurlHandle;
105 CURLM *mCurlMultiHandle; 105 CURLM *mCurlMultiHandle;
106 char *mURLBuffer; 106 std::string mURLBuffer;
107 struct curl_slist *mHTTPHeaders; 107 struct curl_slist *mHTTPHeaders;
108 LLVFile *mVFile; 108 LLVFile *mVFile;
109 LLUUID mTmpUUID; 109 LLUUID mTmpUUID;
@@ -122,7 +122,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp,
122 const LLUUID &uuid, 122 const LLUUID &uuid,
123 LLAssetType::EType type, 123 LLAssetType::EType type,
124 LLAssetStorage::ERequestType rt, 124 LLAssetStorage::ERequestType rt,
125 const char *url, 125 const std::string& url,
126 CURLM *curl_multi) 126 CURLM *curl_multi)
127 : LLAssetRequest(uuid, type), 127 : LLAssetRequest(uuid, type),
128 mZInitialized(false) 128 mZInitialized(false)
@@ -137,11 +137,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp,
137 mZInputBuffer = NULL; 137 mZInputBuffer = NULL;
138 mZInputExhausted = false; 138 mZInputExhausted = false;
139 139
140 mURLBuffer = new char[strlen(url) + 1]; /*Flawfinder: ignore*/ 140 mURLBuffer = url;
141 if (mURLBuffer)
142 {
143 strcpy(mURLBuffer, url); /*Flawfinder: ignore*/
144 }
145} 141}
146 142
147LLHTTPAssetRequest::~LLHTTPAssetRequest() 143LLHTTPAssetRequest::~LLHTTPAssetRequest()
@@ -156,7 +152,6 @@ LLHTTPAssetRequest::~LLHTTPAssetRequest()
156 { 152 {
157 curl_slist_free_all(mHTTPHeaders); 153 curl_slist_free_all(mHTTPHeaders);
158 } 154 }
159 delete[] mURLBuffer;
160 delete mVFile; 155 delete mVFile;
161 finishCompressedUpload(); 156 finishCompressedUpload();
162} 157}
@@ -242,7 +237,7 @@ void LLHTTPAssetRequest::setupCurlHandle()
242 mCurlHandle = curl_easy_init(); 237 mCurlHandle = curl_easy_init();
243 curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1); 238 curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1);
244 curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); 239 curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1);
245 curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer); 240 curl_easy_setopt(mCurlHandle, CURLOPT_URL, mURLBuffer.c_str());
246 curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this); 241 curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this);
247 if (LLAssetStorage::RT_DOWNLOAD == mRequestType) 242 if (LLAssetStorage::RT_DOWNLOAD == mRequestType)
248 { 243 {
@@ -400,9 +395,9 @@ size_t LLHTTPAssetRequest::curlCompressedUploadCallback(
400 395
401LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, 396LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
402 LLVFS *vfs, const LLHost &upstream_host, 397 LLVFS *vfs, const LLHost &upstream_host,
403 const char *web_host, 398 const std::string& web_host,
404 const char *local_web_host, 399 const std::string& local_web_host,
405 const char *host_name) 400 const std::string& host_name)
406 : LLAssetStorage(msg, xfer, vfs, upstream_host) 401 : LLAssetStorage(msg, xfer, vfs, upstream_host)
407{ 402{
408 _init(web_host, local_web_host, host_name); 403 _init(web_host, local_web_host, host_name);
@@ -410,15 +405,15 @@ LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer
410 405
411LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, 406LLHTTPAssetStorage::LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
412 LLVFS *vfs, 407 LLVFS *vfs,
413 const char *web_host, 408 const std::string& web_host,
414 const char *local_web_host, 409 const std::string& local_web_host,
415 const char *host_name) 410 const std::string& host_name)
416 : LLAssetStorage(msg, xfer, vfs) 411 : LLAssetStorage(msg, xfer, vfs)
417{ 412{
418 _init(web_host, local_web_host, host_name); 413 _init(web_host, local_web_host, host_name);
419} 414}
420 415
421void LLHTTPAssetStorage::_init(const char *web_host, const char *local_web_host, const char* host_name) 416void LLHTTPAssetStorage::_init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name)
422{ 417{
423 mBaseURL = web_host; 418 mBaseURL = web_host;
424 mLocalBaseURL = local_web_host; 419 mLocalBaseURL = local_web_host;
@@ -470,7 +465,7 @@ void LLHTTPAssetStorage::storeAssetData(
470 { 465 {
471 message = "Added to upload queue"; 466 message = "Added to upload queue";
472 } 467 }
473 reportMetric( uuid, type, NULL, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message ); 468 reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, size, MR_OKAY, __FILE__, __LINE__, message );
474 469
475 // this will get picked up and transmitted in checkForTimeouts 470 // this will get picked up and transmitted in checkForTimeouts
476 if(store_local) 471 if(store_local)
@@ -492,7 +487,7 @@ void LLHTTPAssetStorage::storeAssetData(
492 if (callback) 487 if (callback)
493 { 488 {
494 // LLAssetStorage metric: Zero size VFS 489 // LLAssetStorage metric: Zero size VFS
495 reportMetric( uuid, type, NULL, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); 490 reportMetric( uuid, type, LLStringUtil::null, requesting_agent_id, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" );
496 callback(uuid, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE); 491 callback(uuid, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE);
497 } 492 }
498 } 493 }
@@ -500,7 +495,7 @@ void LLHTTPAssetStorage::storeAssetData(
500 495
501// virtual 496// virtual
502void LLHTTPAssetStorage::storeAssetData( 497void LLHTTPAssetStorage::storeAssetData(
503 const char* filename, 498 const std::string& filename,
504 const LLUUID& asset_id, 499 const LLUUID& asset_id,
505 LLAssetType::EType asset_type, 500 LLAssetType::EType asset_type,
506 LLStoreAssetCallback callback, 501 LLStoreAssetCallback callback,
@@ -597,7 +592,7 @@ LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt,
597 LLSD& pending = sd["requests"][i]; 592 LLSD& pending = sd["requests"][i];
598 // See if this pending request is running. 593 // See if this pending request is running.
599 const LLAssetRequest* req = findRequest(running, 594 const LLAssetRequest* req = findRequest(running,
600 LLAssetType::lookup(pending["type"].asString().c_str()), 595 LLAssetType::lookup(pending["type"].asString()),
601 pending["asset_id"]); 596 pending["asset_id"]);
602 if (req) 597 if (req)
603 { 598 {
@@ -768,11 +763,11 @@ void LLHTTPAssetStorage::checkForTimeouts()
768 // Setup this curl download request 763 // Setup this curl download request
769 // We need to generate a new request here 764 // We need to generate a new request here
770 // since the one in the list could go away 765 // since the one in the list could go away
771 char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ 766 std::string tmp_url;
772 char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ 767 std::string uuid_str;
773 req->getUUID().toString(uuid_str); 768 req->getUUID().toString(uuid_str);
774 std::string base_url = getBaseURL(req->getUUID(), req->getType()); 769 std::string base_url = getBaseURL(req->getUUID(), req->getType());
775 snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", base_url.c_str() , uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ 770 tmp_url = llformat("%s/%36s.%s", base_url.c_str() , uuid_str.c_str(), LLAssetType::lookup(req->getType()));
776 771
777 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), 772 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),
778 req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle); 773 req->getType(), RT_DOWNLOAD, tmp_url, mCurlMultiHandle);
@@ -805,12 +800,11 @@ void LLHTTPAssetStorage::checkForTimeouts()
805 800
806 bool do_compress = req->getType() == LLAssetType::AT_OBJECT; 801 bool do_compress = req->getType() == LLAssetType::AT_OBJECT;
807 802
808 char tmp_url[MAX_STRING];/*Flawfinder: ignore*/ 803 std::string tmp_url;
809 char uuid_str[UUID_STR_LENGTH];/*Flawfinder: ignore*/ 804 std::string uuid_str;
810 req->getUUID().toString(uuid_str); 805 req->getUUID().toString(uuid_str);
811 snprintf(tmp_url, sizeof(tmp_url), /* Flawfinder: ignore */ 806 tmp_url = mBaseURL + "/" + uuid_str + "." + LLAssetType::lookup(req->getType());
812 do_compress ? "%s/%s.%s.gz" : "%s/%s.%s", 807 if (do_compress) tmp_url += ".gz";
813 mBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType()));
814 808
815 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), 809 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),
816 req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); 810 req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle);
@@ -876,12 +870,12 @@ void LLHTTPAssetStorage::checkForTimeouts()
876 // setup this curl upload request 870 // setup this curl upload request
877 LLVFile file(mVFS, req->getUUID(), req->getType()); 871 LLVFile file(mVFS, req->getUUID(), req->getType());
878 872
879 char tmp_url[MAX_STRING]; /*Flawfinder: ignore*/ 873 std::string tmp_url;
880 char uuid_str[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ 874 std::string uuid_str;
881 req->getUUID().toString(uuid_str); 875 req->getUUID().toString(uuid_str);
882 876
883 // KLW - All temporary uploads are saved locally "http://localhost:12041/asset" 877 // KLW - All temporary uploads are saved locally "http://localhost:12041/asset"
884 snprintf(tmp_url, sizeof(tmp_url), "%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str, LLAssetType::lookup(req->getType())); /* Flawfinder: ignore */ 878 tmp_url = llformat("%s/%36s.%s", mLocalBaseURL.c_str(), uuid_str.c_str(), LLAssetType::lookup(req->getType()));
885 879
886 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), 880 LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(),
887 req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle); 881 req->getType(), RT_LOCALUPLOAD, tmp_url, mCurlMultiHandle);
@@ -1160,7 +1154,7 @@ size_t LLHTTPAssetStorage::nullOutputCallback(void *data, size_t size, size_t nm
1160 1154
1161// blocking asset fetch which bypasses the VFS 1155// blocking asset fetch which bypasses the VFS
1162// this is a very limited function for use by the simstate loader and other one-offs 1156// this is a very limited function for use by the simstate loader and other one-offs
1163S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata) 1157S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata)
1164{ 1158{
1165 // *NOTE: There is no guarantee that the uuid and the asset_type match 1159 // *NOTE: There is no guarantee that the uuid and the asset_type match
1166 // - not that it matters. - Doug 1160 // - not that it matters. - Doug
@@ -1174,7 +1168,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse
1174 } 1168 }
1175 1169
1176 // make sure we use the normal curl setup, even though we don't really need a request object 1170 // make sure we use the normal curl setup, even though we don't really need a request object
1177 LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url.c_str(), mCurlMultiHandle); 1171 LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url, mCurlMultiHandle);
1178 req.mFP = fp; 1172 req.mFP = fp;
1179 1173
1180 req.setupCurlHandle(); 1174 req.setupCurlHandle();
diff --git a/linden/indra/llmessage/llhttpassetstorage.h b/linden/indra/llmessage/llhttpassetstorage.h
index 71e973a..585b281 100644
--- a/linden/indra/llmessage/llhttpassetstorage.h
+++ b/linden/indra/llmessage/llhttpassetstorage.h
@@ -48,15 +48,15 @@ class LLHTTPAssetStorage : public LLAssetStorage
48public: 48public:
49 LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, 49 LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
50 LLVFS *vfs, const LLHost &upstream_host, 50 LLVFS *vfs, const LLHost &upstream_host,
51 const char *web_host, 51 const std::string& web_host,
52 const char *local_web_host, 52 const std::string& local_web_host,
53 const char *host_name); 53 const std::string& host_name);
54 54
55 LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, 55 LLHTTPAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
56 LLVFS *vfs, 56 LLVFS *vfs,
57 const char *web_host, 57 const std::string& web_host,
58 const char *local_web_host, 58 const std::string& local_web_host,
59 const char *host_name); 59 const std::string& host_name);
60 60
61 61
62 virtual ~LLHTTPAssetStorage(); 62 virtual ~LLHTTPAssetStorage();
@@ -74,7 +74,7 @@ public:
74 F64 timeout=LL_ASSET_STORAGE_TIMEOUT); 74 F64 timeout=LL_ASSET_STORAGE_TIMEOUT);
75 75
76 virtual void storeAssetData( 76 virtual void storeAssetData(
77 const char* filename, 77 const std::string& filename,
78 const LLUUID& asset_id, 78 const LLUUID& asset_id,
79 LLAssetType::EType atype, 79 LLAssetType::EType atype,
80 LLStoreAssetCallback callback, 80 LLStoreAssetCallback callback,
@@ -99,7 +99,7 @@ public:
99 // Hack. One off curl download an URL to a file. Probably should be elsewhere. 99 // Hack. One off curl download an URL to a file. Probably should be elsewhere.
100 // Only used by lldynamicstate. The API is broken, and should be replaced with 100 // Only used by lldynamicstate. The API is broken, and should be replaced with
101 // a generic HTTP file fetch - Doug 9/25/06 101 // a generic HTTP file fetch - Doug 9/25/06
102 S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata); 102 S32 getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const std::string &url, const std::string& filename, progress_callback callback, void *userdata);
103 103
104 LLAssetRequest* findNextRequest(request_list_t& pending, request_list_t& running); 104 LLAssetRequest* findNextRequest(request_list_t& pending, request_list_t& running);
105 105
@@ -135,7 +135,7 @@ protected:
135 void *user_data, BOOL duplicate, BOOL is_priority); 135 void *user_data, BOOL duplicate, BOOL is_priority);
136 136
137private: 137private:
138 void _init(const char *web_host, const char *local_web_host, const char* host_name); 138 void _init(const std::string& web_host, const std::string& local_web_host, const std::string& host_name);
139 139
140 // This will return the correct base URI for any http asset request 140 // This will return the correct base URI for any http asset request
141 std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type); 141 std::string getBaseURL(const LLUUID& asset_id, LLAssetType::EType asset_type);
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index 22c0c68..caeaee1 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -122,7 +122,7 @@ namespace
122 { 122 {
123 public: 123 public:
124 RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {} 124 RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
125 virtual ~RawInjector() {} 125 virtual ~RawInjector() {delete mData;}
126 126
127 const char* contentType() { return "application/octet-stream"; } 127 const char* contentType() { return "application/octet-stream"; }
128 128
@@ -152,17 +152,22 @@ namespace
152 { 152 {
153 LLBufferStream ostream(channels, buffer.get()); 153 LLBufferStream ostream(channels, buffer.get());
154 154
155 llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); 155 llifstream fstream(mFilename, std::iostream::binary | std::iostream::out);
156 fstream.seekg(0, std::ios::end); 156 if(fstream.is_open())
157 U32 fileSize = fstream.tellg(); 157 {
158 fstream.seekg(0, std::ios::beg); 158 fstream.seekg(0, std::ios::end);
159 char* fileBuffer; 159 U32 fileSize = fstream.tellg();
160 fileBuffer = new char [fileSize]; 160 fstream.seekg(0, std::ios::beg);
161 fstream.read(fileBuffer, fileSize); 161 char* fileBuffer;
162 ostream.write(fileBuffer, fileSize); 162 fileBuffer = new char [fileSize];
163 fstream.close(); 163 fstream.read(fileBuffer, fileSize);
164 eos = true; 164 ostream.write(fileBuffer, fileSize);
165 return STATUS_DONE; 165 fstream.close();
166 eos = true;
167 return STATUS_DONE;
168 }
169
170 return STATUS_ERROR;
166 } 171 }
167 172
168 const std::string mFilename; 173 const std::string mFilename;
@@ -199,14 +204,13 @@ namespace
199 LLPumpIO* theClientPump = NULL; 204 LLPumpIO* theClientPump = NULL;
200} 205}
201 206
202static void request(const std::string& url, 207static void request(
203 LLURLRequest::ERequestAction method, 208 const std::string& url,
204 Injector* body_injector, 209 LLURLRequest::ERequestAction method,
205 LLCurl::ResponderPtr responder, 210 Injector* body_injector,
206 const LLSD& headers = LLSD(), 211 LLCurl::ResponderPtr responder,
207 const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, 212 const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
208 S32 offset = 0, 213 const LLSD& headers = LLSD())
209 S32 bytes = 0)
210{ 214{
211 if (!LLHTTPClient::hasPump()) 215 if (!LLHTTPClient::hasPump())
212 { 216 {
@@ -215,7 +219,7 @@ static void request(const std::string& url,
215 } 219 }
216 LLPumpIO::chain_t chain; 220 LLPumpIO::chain_t chain;
217 221
218 LLURLRequest *req = new LLURLRequest(method, url); 222 LLURLRequest* req = new LLURLRequest(method, url);
219 req->checkRootCertificate(true); 223 req->checkRootCertificate(true);
220 224
221 // Insert custom headers is the caller sent any 225 // Insert custom headers is the caller sent any
@@ -234,10 +238,10 @@ static void request(const std::string& url,
234 //to not use the proxy (read: llurlrequest.cpp) 238 //to not use the proxy (read: llurlrequest.cpp)
235 if ((iter->first == "Pragma") && (iter->second.asString() == "")) 239 if ((iter->first == "Pragma") && (iter->second.asString() == ""))
236 { 240 {
237 req->useProxy(FALSE); 241 req->useProxy(false);
238 } 242 }
239 header << iter->first << ": " << iter->second.asString() ; 243 header << iter->first << ": " << iter->second.asString() ;
240 llinfos << "header = " << header.str() << llendl; 244 lldebugs << "header = " << header.str() << llendl;
241 req->addHeader(header.str().c_str()); 245 req->addHeader(header.str().c_str());
242 } 246 }
243 } 247 }
@@ -257,25 +261,27 @@ static void request(const std::string& url,
257 chain.push_back(LLIOPipe::ptr_t(body_injector)); 261 chain.push_back(LLIOPipe::ptr_t(body_injector));
258 } 262 }
259 263
260 if (method == LLURLRequest::HTTP_GET && (offset > 0 || bytes > 0))
261 {
262 std::string range = llformat("Range: bytes=%d-%d", offset,offset+bytes-1);
263 req->addHeader(range.c_str());
264 }
265
266 chain.push_back(LLIOPipe::ptr_t(req)); 264 chain.push_back(LLIOPipe::ptr_t(req));
267 265
268 theClientPump->addChain(chain, timeout); 266 theClientPump->addChain(chain, timeout);
269} 267}
270 268
271 269
272void LLHTTPClient::getByteRange(const std::string& url, 270void LLHTTPClient::getByteRange(
273 S32 offset, S32 bytes, 271 const std::string& url,
274 ResponderPtr responder, 272 S32 offset,
275 const LLSD& headers, 273 S32 bytes,
276 const F32 timeout) 274 ResponderPtr responder,
275 const LLSD& hdrs,
276 const F32 timeout)
277{ 277{
278 request(url, LLURLRequest::HTTP_GET, NULL, responder, LLSD(), timeout, offset, bytes); 278 LLSD headers = hdrs;
279 if(offset > 0 || bytes > 0)
280 {
281 std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1);
282 headers["Range"] = range;
283 }
284 request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
279} 285}
280 286
281void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) 287void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout)
@@ -285,11 +291,11 @@ void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F3
285 291
286void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) 292void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
287{ 293{
288 request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout); 294 request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers);
289} 295}
290void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) 296void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
291{ 297{
292 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers, timeout); 298 request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers);
293} 299}
294void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout) 300void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout)
295{ 301{
@@ -401,17 +407,11 @@ void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr r
401 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout); 407 request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout);
402} 408}
403 409
404void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout) 410void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
405{ 411{
406 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); 412 request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout);
407} 413}
408 414
409void LLHTTPClient::del(const std::string& url, ResponderPtr responder, const F32 timeout)
410{
411 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout);
412}
413
414#if 1
415void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) 415void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout)
416{ 416{
417 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); 417 request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout);
@@ -422,7 +422,28 @@ void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid,
422{ 422{
423 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); 423 request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout);
424} 424}
425#endif 425
426// static
427void LLHTTPClient::del(
428 const std::string& url,
429 ResponderPtr responder,
430 const F32 timeout)
431{
432 request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout);
433}
434
435// static
436void LLHTTPClient::move(
437 const std::string& url,
438 const std::string& destination,
439 ResponderPtr responder,
440 const F32 timeout)
441{
442 LLSD headers;
443 headers["Destination"] = destination;
444 request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers);
445}
446
426 447
427void LLHTTPClient::setPump(LLPumpIO& pump) 448void LLHTTPClient::setPump(LLPumpIO& pump)
428{ 449{
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h
index df31b44..50c6f7a 100644
--- a/linden/indra/llmessage/llhttpclient.h
+++ b/linden/indra/llmessage/llhttpclient.h
@@ -60,7 +60,8 @@ public:
60 typedef LLCurl::Responder Responder; 60 typedef LLCurl::Responder Responder;
61 typedef LLCurl::ResponderPtr ResponderPtr; 61 typedef LLCurl::ResponderPtr ResponderPtr;
62 62
63 // non-blocking 63 /** @name non-blocking API */
64 //@{
64 static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 65 static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
65 static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 66 static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
66 static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 67 static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
@@ -70,13 +71,38 @@ public:
70 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 71 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
71 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 72 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
72 73
73 ///< non-blocking
74 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 74 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
75 static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 75
76 /** Takes ownership of data and deletes it when sent */
77 static void postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
78
76 static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 79 static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
80 #
77 static void postFile(const std::string& url, const LLUUID& uuid, 81 static void postFile(const std::string& url, const LLUUID& uuid,
78 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 82 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
79 83
84 static void del(
85 const std::string& url,
86 ResponderPtr responder,
87 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
88 ///< sends a DELETE method, but we can't call it delete in c++
89
90 /**
91 * @brief Send a MOVE webdav method
92 *
93 * @param url The complete serialized (and escaped) url to get.
94 * @param destination The complete serialized destination url.
95 * @param responder The responder that will handle the result.
96 * @param timeout The number of seconds to give the server to respond.
97 */
98 static void move(
99 const std::string& url,
100 const std::string& destination,
101 ResponderPtr responder,
102 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
103
104 //@}
105
80 /** 106 /**
81 * @brief Blocking HTTP get that returns an LLSD map of status and body. 107 * @brief Blocking HTTP get that returns an LLSD map of status and body.
82 * 108 *
@@ -85,9 +111,7 @@ public:
85 */ 111 */
86 static LLSD blockingGet(const std::string& url); 112 static LLSD blockingGet(const std::string& url);
87 113
88 static void del(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); 114
89 ///< sends a DELETE method, but we can't call it delete in c++
90
91 115
92 static void setPump(LLPumpIO& pump); 116 static void setPump(LLPumpIO& pump);
93 ///< must be called before any of the above calls are made 117 ///< must be called before any of the above calls are made
diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp
index 46f2061..772fb17 100644
--- a/linden/indra/llmessage/llhttpnode.cpp
+++ b/linden/indra/llmessage/llhttpnode.cpp
@@ -174,6 +174,26 @@ LLSD LLHTTPNode::del(const LLSD&) const
174 throw NotImplemented(); 174 throw NotImplemented();
175} 175}
176 176
177// virtual
178void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const
179{
180 //llinfos << "options context: " << context << llendl;
181
182 // default implementation constructs an url to the documentation.
183 std::string host = context[CONTEXT_REQUEST]["headers"]["host"].asString();
184 if(host.empty())
185 {
186 response->status(400, "Bad Request -- need Host header");
187 return;
188 }
189 std::ostringstream ostr;
190 ostr << "http://" << host << "/web/server/api";
191 ostr << context[CONTEXT_REQUEST]["path"].asString();
192 static const std::string DOC_HEADER("X-Documentation-URL");
193 response->addHeader(DOC_HEADER, ostr.str());
194 response->status(200, "OK");
195}
196
177 197
178// virtual 198// virtual
179LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const 199LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const
@@ -386,6 +406,13 @@ void LLHTTPNode::Response::methodNotAllowed()
386 status(405, "Method Not Allowed"); 406 status(405, "Method Not Allowed");
387} 407}
388 408
409void LLHTTPNode::Response::addHeader(
410 const std::string& name,
411 const std::string& value)
412{
413 mHeaders[name] = value;
414}
415
389void LLHTTPNode::describe(Description& desc) const 416void LLHTTPNode::describe(Description& desc) const
390{ 417{
391 desc.shortInfo("unknown service (missing describe() method)"); 418 desc.shortInfo("unknown service (missing describe() method)");
diff --git a/linden/indra/llmessage/llhttpnode.h b/linden/indra/llmessage/llhttpnode.h
index 02e8ceb..4339e5c 100644
--- a/linden/indra/llmessage/llhttpnode.h
+++ b/linden/indra/llmessage/llhttpnode.h
@@ -82,33 +82,79 @@ public:
82 */ 82 */
83 //@{ 83 //@{
84public: 84public:
85 virtual LLSD get() const;
86 virtual LLSD put(const LLSD& input) const;
87 virtual LLSD post(const LLSD& input) const;
88 85
89 virtual LLSD del(const LLSD& context) const; 86 virtual LLSD get() const;
87 virtual LLSD put(const LLSD& input) const;
88 virtual LLSD post(const LLSD& input) const;
89 virtual LLSD del(const LLSD& context) const;
90 90
91 class Response : public LLRefCount 91 class Response : public LLRefCount
92 { 92 {
93 protected: 93 protected:
94 virtual ~Response(); 94 virtual ~Response();
95 95
96 public: 96 public:
97 virtual void result(const LLSD&) = 0; 97 /**
98 virtual void status(S32 code, const std::string& message) = 0; 98 * @brief Return the LLSD content and a 200 OK.
99 */
100 virtual void result(const LLSD&) = 0;
101
102 /**
103 * @brief return status code and reason string on http header,
104 * but do not return a payload.
105 */
106 virtual void status(S32 code, const std::string& message) = 0;
107
108 /**
109 * @brief Return no body, just status code and 'UNKNOWN ERROR'.
110 */
111 void status(S32 code);
112
113 void notFound(const std::string& message);
114 void notFound();
115 void methodNotAllowed();
116
117 /**
118 * @breif Add a name: value http header.
119 *
120 * No effort is made to ensure the response is a valid http
121 * header.
122 * The headers are stored as a map of header name : value.
123 * Though HTTP allows the same header name to be transmitted
124 * more than once, this implementation only stores a header
125 * name once.
126 * @param name The name of the header, eg, "Content-Encoding"
127 * @param value The value of the header, eg, "gzip"
128 */
129 void addHeader(const std::string& name, const std::string& value);
130
131 protected:
132 /**
133 * @brief Headers to be sent back with the HTTP response.
134 *
135 * Protected class membership since derived classes are
136 * expected to use it and there is no use case yet for other
137 * uses. If such a use case arises, I suggest making a
138 * headers() public method, and moving this member data into
139 * private.
140 */
141 LLSD mHeaders;
142 };
99 143
100 void status(S32 code);
101 void notFound(const std::string& message);
102 void notFound();
103 void methodNotAllowed();
104 };
105 144
106 typedef LLPointer<Response> ResponsePtr; 145 typedef LLPointer<Response> ResponsePtr;
107 146
108 virtual void get(ResponsePtr, const LLSD& context) const; 147 virtual void get(ResponsePtr, const LLSD& context) const;
109 virtual void put(ResponsePtr, const LLSD& context, const LLSD& input) const; 148 virtual void put(
110 virtual void post(ResponsePtr, const LLSD& context, const LLSD& input) const; 149 ResponsePtr,
111 virtual void del(ResponsePtr, const LLSD& context) const; 150 const LLSD& context,
151 const LLSD& input) const;
152 virtual void post(
153 ResponsePtr,
154 const LLSD& context,
155 const LLSD& input) const;
156 virtual void del(ResponsePtr, const LLSD& context) const;
157 virtual void options(ResponsePtr, const LLSD& context) const;
112 //@} 158 //@}
113 159
114 160
diff --git a/linden/indra/llmessage/llhttpsender.cpp b/linden/indra/llmessage/llhttpsender.cpp
index f0b453d..f72a7be 100644
--- a/linden/indra/llmessage/llhttpsender.cpp
+++ b/linden/indra/llmessage/llhttpsender.cpp
@@ -52,7 +52,7 @@ LLHTTPSender::~LLHTTPSender()
52} 52}
53 53
54//virtual 54//virtual
55void LLHTTPSender::send(const LLHost& host, const char* name, 55void LLHTTPSender::send(const LLHost& host, const std::string& name,
56 const LLSD& body, 56 const LLSD& body,
57 LLHTTPClient::ResponderPtr response) const 57 LLHTTPClient::ResponderPtr response) const
58{ 58{
diff --git a/linden/indra/llmessage/llhttpsender.h b/linden/indra/llmessage/llhttpsender.h
index 86dd754..9073f48 100644
--- a/linden/indra/llmessage/llhttpsender.h
+++ b/linden/indra/llmessage/llhttpsender.h
@@ -45,7 +45,7 @@ class LLHTTPSender
45 45
46 /** @brief Send message to host with body, call response when done */ 46 /** @brief Send message to host with body, call response when done */
47 virtual void send(const LLHost& host, 47 virtual void send(const LLHost& host,
48 const char* message, const LLSD& body, 48 const std::string& message, const LLSD& body,
49 LLHTTPClient::ResponderPtr response) const; 49 LLHTTPClient::ResponderPtr response) const;
50 50
51 /** @brief Set sender for host, takes ownership of sender. */ 51 /** @brief Set sender for host, takes ownership of sender. */
diff --git a/linden/indra/llmessage/llinstantmessage.cpp b/linden/indra/llmessage/llinstantmessage.cpp
index 390a6fa..5012741 100644
--- a/linden/indra/llmessage/llinstantmessage.cpp
+++ b/linden/indra/llmessage/llinstantmessage.cpp
@@ -59,7 +59,7 @@ const S32 VOTE_UNANIMOUS = 2;
59const char EMPTY_BINARY_BUCKET[] = ""; 59const char EMPTY_BINARY_BUCKET[] = "";
60const S32 EMPTY_BINARY_BUCKET_SIZE = 1; 60const S32 EMPTY_BINARY_BUCKET_SIZE = 1;
61const U32 NO_TIMESTAMP = 0; 61const U32 NO_TIMESTAMP = 0;
62const char SYSTEM_FROM[] = "Second Life"; 62const std::string SYSTEM_FROM("Second Life");
63const S32 IM_TTL = 1; 63const S32 IM_TTL = 1;
64 64
65 65
@@ -144,8 +144,8 @@ void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const
144 mFromGroup, 144 mFromGroup,
145 LLUUID::null, 145 LLUUID::null,
146 mToID, 146 mToID,
147 mName.c_str(), 147 mName,
148 mMessage.c_str(), 148 mMessage,
149 mOffline, 149 mOffline,
150 mIMType, 150 mIMType,
151 mID, 151 mID,
@@ -163,8 +163,8 @@ void pack_instant_message(
163 BOOL from_group, 163 BOOL from_group,
164 const LLUUID& session_id, 164 const LLUUID& session_id,
165 const LLUUID& to_id, 165 const LLUUID& to_id,
166 const char* name, 166 const std::string& name,
167 const char* message, 167 const std::string& message,
168 U8 offline, 168 U8 offline,
169 EInstantMessage dialog, 169 EInstantMessage dialog,
170 const LLUUID& id, 170 const LLUUID& id,
@@ -202,8 +202,8 @@ void pack_instant_message_block(
202 BOOL from_group, 202 BOOL from_group,
203 const LLUUID& session_id, 203 const LLUUID& session_id,
204 const LLUUID& to_id, 204 const LLUUID& to_id,
205 const char* name, 205 const std::string& name,
206 const char* message, 206 const std::string& message,
207 U8 offline, 207 U8 offline,
208 EInstantMessage dialog, 208 EInstantMessage dialog,
209 const LLUUID& id, 209 const LLUUID& id,
@@ -229,10 +229,10 @@ void pack_instant_message_block(
229 msg->addU32Fast(_PREHASH_Timestamp, timestamp); 229 msg->addU32Fast(_PREHASH_Timestamp, timestamp);
230 msg->addStringFast(_PREHASH_FromAgentName, name); 230 msg->addStringFast(_PREHASH_FromAgentName, name);
231 S32 bytes_left = MTUBYTES; 231 S32 bytes_left = MTUBYTES;
232 if(message) 232 if(!message.empty())
233 { 233 {
234 char buffer[MTUBYTES]; 234 char buffer[MTUBYTES];
235 int num_written = snprintf(buffer, MTUBYTES, "%s", message); /* Flawfinder: ignore */ 235 int num_written = snprintf(buffer, MTUBYTES, "%s", message.c_str()); /* Flawfinder: ignore */
236 // snprintf returns number of bytes that would have been written 236 // snprintf returns number of bytes that would have been written
237 // had the output not being truncated. In that case, it will 237 // had the output not being truncated. In that case, it will
238 // return either -1 or value >= passed in size value . So a check needs to be added 238 // return either -1 or value >= passed in size value . So a check needs to be added
@@ -281,13 +281,9 @@ void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg)
281 mIMType = (EInstantMessage) dialog; 281 mIMType = (EInstantMessage) dialog;
282 msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); 282 msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID);
283 msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); 283 msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp);
284 char name[DB_FULL_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 284 msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName);
285 msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name);
286 mName.assign(name);
287 285
288 char message[DB_IM_MSG_BUF_SIZE]; /*Flawfinder: ignore*/ 286 msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage);
289 msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message);
290 mMessage.assign(message);
291 287
292 S32 binary_bucket_size = llmin( 288 S32 binary_bucket_size = llmin(
293 MTUBYTES, 289 MTUBYTES,
diff --git a/linden/indra/llmessage/llinstantmessage.h b/linden/indra/llmessage/llinstantmessage.h
index 35127c3..d95b551 100644
--- a/linden/indra/llmessage/llinstantmessage.h
+++ b/linden/indra/llmessage/llinstantmessage.h
@@ -222,7 +222,7 @@ extern const char EMPTY_BINARY_BUCKET[];
222extern const S32 EMPTY_BINARY_BUCKET_SIZE; 222extern const S32 EMPTY_BINARY_BUCKET_SIZE;
223 223
224extern const U32 NO_TIMESTAMP; 224extern const U32 NO_TIMESTAMP;
225extern const char SYSTEM_FROM[]; 225extern const std::string SYSTEM_FROM;
226 226
227// Number of retry attempts on sending the im. 227// Number of retry attempts on sending the im.
228extern const S32 IM_TTL; 228extern const S32 IM_TTL;
@@ -289,8 +289,8 @@ void pack_instant_message(
289 BOOL from_group, 289 BOOL from_group,
290 const LLUUID& session_id, 290 const LLUUID& session_id,
291 const LLUUID& to_id, 291 const LLUUID& to_id,
292 const char* name, 292 const std::string& name,
293 const char* message, 293 const std::string& message,
294 U8 offline = IM_ONLINE, 294 U8 offline = IM_ONLINE,
295 EInstantMessage dialog = IM_NOTHING_SPECIAL, 295 EInstantMessage dialog = IM_NOTHING_SPECIAL,
296 const LLUUID& id = LLUUID::null, 296 const LLUUID& id = LLUUID::null,
@@ -307,8 +307,8 @@ void pack_instant_message_block(
307 BOOL from_group, 307 BOOL from_group,
308 const LLUUID& session_id, 308 const LLUUID& session_id,
309 const LLUUID& to_id, 309 const LLUUID& to_id,
310 const char* name, 310 const std::string& name,
311 const char* message, 311 const std::string& message,
312 U8 offline = IM_ONLINE, 312 U8 offline = IM_ONLINE,
313 EInstantMessage dialog = IM_NOTHING_SPECIAL, 313 EInstantMessage dialog = IM_NOTHING_SPECIAL,
314 const LLUUID& id = LLUUID::null, 314 const LLUUID& id = LLUUID::null,
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index 2ebf117..d4155f6 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -57,10 +57,13 @@
57static const char HTTP_VERSION_STR[] = "HTTP/1.0"; 57static const char HTTP_VERSION_STR[] = "HTTP/1.0";
58static const std::string CONTEXT_REQUEST("request"); 58static const std::string CONTEXT_REQUEST("request");
59static const std::string CONTEXT_RESPONSE("response"); 59static const std::string CONTEXT_RESPONSE("response");
60static const std::string CONTEXT_VERB("verb");
61static const std::string CONTEXT_HEADERS("headers");
60static const std::string HTTP_VERB_GET("GET"); 62static const std::string HTTP_VERB_GET("GET");
61static const std::string HTTP_VERB_PUT("PUT"); 63static const std::string HTTP_VERB_PUT("PUT");
62static const std::string HTTP_VERB_POST("POST"); 64static const std::string HTTP_VERB_POST("POST");
63static const std::string HTTP_VERB_DELETE("DELETE"); 65static const std::string HTTP_VERB_DELETE("DELETE");
66static const std::string HTTP_VERB_OPTIONS("OPTIONS");
64 67
65static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; 68static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL;
66static void* sTimingCallbackData = NULL; 69static void* sTimingCallbackData = NULL;
@@ -130,6 +133,7 @@ private:
130 LLSD mGoodResult; 133 LLSD mGoodResult;
131 S32 mStatusCode; 134 S32 mStatusCode;
132 std::string mStatusMessage; 135 std::string mStatusMessage;
136 LLSD mHeaders;
133}; 137};
134 138
135LLIOPipe::EStatus LLHTTPPipe::process_impl( 139LLIOPipe::EStatus LLHTTPPipe::process_impl(
@@ -164,7 +168,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
164 static LLTimer timer; 168 static LLTimer timer;
165 timer.reset(); 169 timer.reset();
166 170
167 std::string verb = context[CONTEXT_REQUEST]["verb"]; 171 std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];
168 if(verb == HTTP_VERB_GET) 172 if(verb == HTTP_VERB_GET)
169 { 173 {
170 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); 174 mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);
@@ -185,6 +189,10 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
185 { 189 {
186 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); 190 mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);
187 } 191 }
192 else if(verb == HTTP_VERB_OPTIONS)
193 {
194 mNode.options(LLHTTPNode::ResponsePtr(mResponse), context);
195 }
188 else 196 else
189 { 197 {
190 mResponse->methodNotAllowed(); 198 mResponse->methodNotAllowed();
@@ -231,7 +239,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
231 239
232 case STATE_GOOD_RESULT: 240 case STATE_GOOD_RESULT:
233 { 241 {
234 context[CONTEXT_RESPONSE]["contentType"] = "application/xml"; 242 LLSD headers = mHeaders;
243 headers["Content-Type"] = "application/xml";
244 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
235 LLBufferStream ostr(channels, buffer.get()); 245 LLBufferStream ostr(channels, buffer.get());
236 LLSDSerialize::toXML(mGoodResult, ostr); 246 LLSDSerialize::toXML(mGoodResult, ostr);
237 247
@@ -240,7 +250,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
240 250
241 case STATE_STATUS_RESULT: 251 case STATE_STATUS_RESULT:
242 { 252 {
243 context[CONTEXT_RESPONSE]["contentType"] = "text/plain"; 253 LLSD headers = mHeaders;
254 headers["Content-Type"] = "text/plain";
255 context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
244 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; 256 context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode;
245 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage; 257 context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;
246 LLBufferStream ostr(channels, buffer.get()); 258 LLBufferStream ostr(channels, buffer.get());
@@ -287,6 +299,7 @@ void LLHTTPPipe::Response::result(const LLSD& r)
287 mPipe->mStatusMessage = "OK"; 299 mPipe->mStatusMessage = "OK";
288 mPipe->mGoodResult = r; 300 mPipe->mGoodResult = r;
289 mPipe->mState = STATE_GOOD_RESULT; 301 mPipe->mState = STATE_GOOD_RESULT;
302 mPipe->mHeaders = mHeaders;
290 mPipe->unlockChain(); 303 mPipe->unlockChain();
291} 304}
292 305
@@ -302,6 +315,7 @@ void LLHTTPPipe::Response::status(S32 code, const std::string& message)
302 mPipe->mStatusCode = code; 315 mPipe->mStatusCode = code;
303 mPipe->mStatusMessage = message; 316 mPipe->mStatusMessage = message;
304 mPipe->mState = STATE_STATUS_RESULT; 317 mPipe->mState = STATE_STATUS_RESULT;
318 mPipe->mHeaders = mHeaders;
305 mPipe->unlockChain(); 319 mPipe->unlockChain();
306} 320}
307 321
@@ -389,17 +403,24 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
389 } 403 }
390 404
391 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; 405 ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n";
392
393 std::string type = context[CONTEXT_RESPONSE]["contentType"].asString();
394 if (!type.empty())
395 {
396 ostr << "Content-Type: " << type << "\r\n";
397 }
398 S32 content_length = buffer->countAfter(channels.in(), NULL); 406 S32 content_length = buffer->countAfter(channels.in(), NULL);
399 if(0 < content_length) 407 if(0 < content_length)
400 { 408 {
401 ostr << "Content-Length: " << content_length << "\r\n"; 409 ostr << "Content-Length: " << content_length << "\r\n";
402 } 410 }
411 // *NOTE: This guard can go away once the LLSD static map
412 // iterator is available. Phoenix. 2008-05-09
413 LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS];
414 if(headers.isDefined())
415 {
416 LLSD::map_iterator iter = headers.beginMap();
417 LLSD::map_iterator end = headers.endMap();
418 for(; iter != end; ++iter)
419 {
420 ostr << (*iter).first << ": " << (*iter).second.asString()
421 << "\r\n";
422 }
423 }
403 ostr << "\r\n"; 424 ostr << "\r\n";
404 425
405 LLChangeChannel change(channels.in(), channels.out()); 426 LLChangeChannel change(channels.in(), channels.out());
@@ -606,11 +627,12 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
606 read_next_line = true; 627 read_next_line = true;
607 LLMemoryStream header((U8*)buf, len); 628 LLMemoryStream header((U8*)buf, len);
608 header >> mVerb; 629 header >> mVerb;
609 630
610 if((HTTP_VERB_GET == mVerb) 631 if((HTTP_VERB_GET == mVerb)
611 || (HTTP_VERB_POST == mVerb) 632 || (HTTP_VERB_POST == mVerb)
612 || (HTTP_VERB_PUT == mVerb) 633 || (HTTP_VERB_PUT == mVerb)
613 || (HTTP_VERB_DELETE == mVerb)) 634 || (HTTP_VERB_DELETE == mVerb)
635 || (HTTP_VERB_OPTIONS == mVerb))
614 { 636 {
615 header >> mAbsPathAndQuery; 637 header >> mAbsPathAndQuery;
616 header >> mVersion; 638 header >> mVersion;
@@ -685,7 +707,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
685 read_next_line = true; 707 read_next_line = true;
686 std::string name(buf, pos_colon - buf); 708 std::string name(buf, pos_colon - buf);
687 std::string value(pos_colon + 2); 709 std::string value(pos_colon + 2);
688 LLString::toLower(name); 710 LLStringUtil::toLower(name);
689 if("content-length" == name) 711 if("content-length" == name)
690 { 712 {
691 lldebugs << "Content-Length: " << value << llendl; 713 lldebugs << "Content-Length: " << value << llendl;
@@ -693,7 +715,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
693 } 715 }
694 else 716 else
695 { 717 {
696 LLString::trimTail(value); 718 LLStringUtil::trimTail(value);
697 mHeaders[name] = value; 719 mHeaders[name] = value;
698 } 720 }
699 } 721 }
@@ -721,7 +743,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
721 { 743 {
722 // hey, hey, we should have everything now, so we pass it to 744 // hey, hey, we should have everything now, so we pass it to
723 // a content handler. 745 // a content handler.
724 context[CONTEXT_REQUEST]["verb"] = mVerb; 746 context[CONTEXT_REQUEST][CONTEXT_VERB] = mVerb;
725 const LLHTTPNode* node = mRootNode.traverse(mPath, context); 747 const LLHTTPNode* node = mRootNode.traverse(mPath, context);
726 if(node) 748 if(node)
727 { 749 {
@@ -765,7 +787,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
765 = mBuildContext["remote-host"]; 787 = mBuildContext["remote-host"];
766 context[CONTEXT_REQUEST]["remote-port"] 788 context[CONTEXT_REQUEST]["remote-port"]
767 = mBuildContext["remote-port"]; 789 = mBuildContext["remote-port"];
768 context[CONTEXT_REQUEST]["headers"] = mHeaders; 790 context[CONTEXT_REQUEST][CONTEXT_HEADERS] = mHeaders;
769 791
770 const LLChainIOFactory* protocolHandler 792 const LLChainIOFactory* protocolHandler
771 = node->getProtocolHandler(); 793 = node->getProtocolHandler();
diff --git a/linden/indra/llmessage/lliopipe.cpp b/linden/indra/llmessage/lliopipe.cpp
index 3b52fae..1e40940 100644
--- a/linden/indra/llmessage/lliopipe.cpp
+++ b/linden/indra/llmessage/lliopipe.cpp
@@ -55,6 +55,7 @@ static const std::string STATUS_ERROR_NAMES[LLIOPipe::STATUS_ERROR_COUNT] =
55 std::string("STATUS_EXPIRED"), 55 std::string("STATUS_EXPIRED"),
56}; 56};
57 57
58#ifdef LL_DEBUG_PUMPS
58// Debugging schmutz for deadlock 59// Debugging schmutz for deadlock
59const char *gPumpFile = ""; 60const char *gPumpFile = "";
60S32 gPumpLine = 0; 61S32 gPumpLine = 0;
@@ -64,6 +65,7 @@ void pump_debug(const char *file, S32 line)
64 gPumpFile = file; 65 gPumpFile = file;
65 gPumpLine = line; 66 gPumpLine = line;
66} 67}
68#endif /* LL_DEBUG_PUMPS */
67 69
68/** 70/**
69 * LLIOPipe 71 * LLIOPipe
diff --git a/linden/indra/llmessage/lliopipe.h b/linden/indra/llmessage/lliopipe.h
index 97c6246..a451dd7 100644
--- a/linden/indra/llmessage/lliopipe.h
+++ b/linden/indra/llmessage/lliopipe.h
@@ -36,7 +36,7 @@
36 36
37#include <boost/intrusive_ptr.hpp> 37#include <boost/intrusive_ptr.hpp>
38#include <boost/shared_ptr.hpp> 38#include <boost/shared_ptr.hpp>
39#include "apr-1/apr_poll.h" 39#include "apr_poll.h"
40 40
41#include "llsd.h" 41#include "llsd.h"
42 42
@@ -46,11 +46,14 @@ class LLBufferArray;
46class LLChannelDescriptors; 46class LLChannelDescriptors;
47 47
48// Debugging schmutz for deadlocks 48// Debugging schmutz for deadlocks
49#define LL_DEBUG_PUMPS 49//#define LL_DEBUG_PUMPS
50#ifdef LL_DEBUG_PUMPS 50#ifdef LL_DEBUG_PUMPS
51void pump_debug(const char *file, S32 line); 51void pump_debug(const char *file, S32 line);
52#define PUMP_DEBUG pump_debug(__FILE__, __LINE__); 52#define PUMP_DEBUG pump_debug(__FILE__, __LINE__);
53#define END_PUMP_DEBUG pump_debug("none", 0); 53#define END_PUMP_DEBUG pump_debug("none", 0);
54#else /* LL_DEBUG_PUMPS */
55#define PUMP_DEBUG
56#define END_PUMP_DEBUG
54#endif 57#endif
55 58
56 59
diff --git a/linden/indra/llmessage/lliosocket.cpp b/linden/indra/llmessage/lliosocket.cpp
index 26fd0b2..dec83b0 100644
--- a/linden/indra/llmessage/lliosocket.cpp
+++ b/linden/indra/llmessage/lliosocket.cpp
@@ -68,7 +68,7 @@ bool is_addr_in_use(apr_status_t status)
68// Define this to see the actual file descriptors being tossed around. 68// Define this to see the actual file descriptors being tossed around.
69//#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1 69//#define LL_DEBUG_SOCKET_FILE_DESCRIPTORS 1
70#if LL_DEBUG_SOCKET_FILE_DESCRIPTORS 70#if LL_DEBUG_SOCKET_FILE_DESCRIPTORS
71#include "apr-1/apr_portable.h" 71#include "apr_portable.h"
72#endif 72#endif
73#endif 73#endif
74 74
@@ -220,11 +220,11 @@ bool LLSocket::blockingConnect(const LLHost& host)
220{ 220{
221 if(!mSocket) return false; 221 if(!mSocket) return false;
222 apr_sockaddr_t* sa = NULL; 222 apr_sockaddr_t* sa = NULL;
223 char ip_address[MAXADDRSTR]; /*Flawfinder: ignore*/ 223 std::string ip_address;
224 host.getIPString(ip_address, MAXADDRSTR); 224 ip_address = host.getIPString();
225 if(ll_apr_warn_status(apr_sockaddr_info_get( 225 if(ll_apr_warn_status(apr_sockaddr_info_get(
226 &sa, 226 &sa,
227 ip_address, 227 ip_address.c_str(),
228 APR_UNSPEC, 228 APR_UNSPEC,
229 host.getPort(), 229 host.getPort(),
230 0, 230 0,
diff --git a/linden/indra/llmessage/lliosocket.h b/linden/indra/llmessage/lliosocket.h
index f0b788e..5b6c11f 100644
--- a/linden/indra/llmessage/lliosocket.h
+++ b/linden/indra/llmessage/lliosocket.h
@@ -43,8 +43,8 @@
43 */ 43 */
44 44
45#include "lliopipe.h" 45#include "lliopipe.h"
46#include "apr-1/apr_pools.h" 46#include "apr_pools.h"
47#include "apr-1/apr_network_io.h" 47#include "apr_network_io.h"
48#include "llchainio.h" 48#include "llchainio.h"
49 49
50class LLHost; 50class LLHost;
diff --git a/linden/indra/llmessage/llmail.cpp b/linden/indra/llmessage/llmail.cpp
index 659803a..8ae7206 100644
--- a/linden/indra/llmessage/llmail.cpp
+++ b/linden/indra/llmessage/llmail.cpp
@@ -42,10 +42,9 @@
42 42
43#include <string> 43#include <string>
44#include <sstream> 44#include <sstream>
45#include <boost/regex.hpp>
46 45
47#include "apr-1/apr_pools.h" 46#include "apr_pools.h"
48#include "apr-1/apr_network_io.h" 47#include "apr_network_io.h"
49 48
50#include "llapr.h" 49#include "llapr.h"
51#include "llbase32.h" // IM-to-email address 50#include "llbase32.h" // IM-to-email address
@@ -66,8 +65,6 @@ static apr_pool_t* gMailPool;
66static apr_sockaddr_t* gSockAddr; 65static apr_sockaddr_t* gSockAddr;
67static apr_socket_t* gMailSocket; 66static apr_socket_t* gMailSocket;
68 67
69// According to RFC2822
70static const boost::regex valid_subject_chars("[\\x1-\\x9\\xb\\xc\\xe-\\x7f]*");
71bool connect_smtp(); 68bool connect_smtp();
72void disconnect_smtp(); 69void disconnect_smtp();
73 70
@@ -173,6 +170,22 @@ void LLMail::enable(bool mail_enabled)
173 gMailEnabled = mail_enabled; 170 gMailEnabled = mail_enabled;
174} 171}
175 172
173// Test a subject line for RFC2822 compliance.
174static bool valid_subject_chars(const char *subject)
175{
176 for (; *subject != '\0'; subject++)
177 {
178 unsigned char c = *subject;
179
180 if (c == '\xa' || c == '\xd' || c > '\x7f')
181 {
182 return false;
183 }
184 }
185
186 return true;
187}
188
176// static 189// static
177std::string LLMail::buildSMTPTransaction( 190std::string LLMail::buildSMTPTransaction(
178 const char* from_name, 191 const char* from_name,
@@ -187,7 +200,7 @@ std::string LLMail::buildSMTPTransaction(
187 << " from address." << llendl; 200 << " from address." << llendl;
188 return std::string(); 201 return std::string();
189 } 202 }
190 if(! boost::regex_match(subject, valid_subject_chars)) 203 if(!valid_subject_chars(subject))
191 { 204 {
192 llinfos << "send_mail build_smtp_transaction reject: bad subject header: " 205 llinfos << "send_mail build_smtp_transaction reject: bad subject header: "
193 << "to=<" << to_address 206 << "to=<" << to_address
@@ -352,7 +365,7 @@ std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id,
352 std::string address = LLBase32::encode(encrypted, encrypted_size); 365 std::string address = LLBase32::encode(encrypted, encrypted_size);
353 366
354 // Make it more pretty for humans. 367 // Make it more pretty for humans.
355 LLString::toLower(address); 368 LLStringUtil::toLower(address);
356 369
357 delete [] encrypted; 370 delete [] encrypted;
358 371
diff --git a/linden/indra/llmessage/llmessage.vcproj b/linden/indra/llmessage/llmessage.vcproj
deleted file mode 100644
index b011c24..0000000
--- a/linden/indra/llmessage/llmessage.vcproj
+++ /dev/null
@@ -1,675 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="7.10"
5 Name="llmessage"
6 ProjectGUID="{E5D94794-5671-4BD6-A16D-26EC18F3DB34}"
7 RootNamespace="llmessage"
8 Keyword="Win32Proj">
9 <Platforms>
10 <Platform
11 Name="Win32"/>
12 </Platforms>
13 <Configurations>
14 <Configuration
15 Name="Debug|Win32"
16 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
17 IntermediateDirectory="Debug"
18 ConfigurationType="4"
19 CharacterSet="1">
20 <Tool
21 Name="VCCLCompilerTool"
22 Optimization="0"
23 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
24 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG"
25 MinimalRebuild="TRUE"
26 BasicRuntimeChecks="3"
27 RuntimeLibrary="1"
28 StructMemberAlignment="4"
29 ForceConformanceInForLoopScope="TRUE"
30 UsePrecompiledHeader="0"
31 WarningLevel="3"
32 WarnAsError="TRUE"
33 Detect64BitPortabilityProblems="FALSE"
34 DebugInformationFormat="4"/>
35 <Tool
36 Name="VCCustomBuildTool"/>
37 <Tool
38 Name="VCLibrarianTool"
39 OutputFile="$(OutDir)/llmessage.lib"/>
40 <Tool
41 Name="VCMIDLTool"/>
42 <Tool
43 Name="VCPostBuildEventTool"/>
44 <Tool
45 Name="VCPreBuildEventTool"/>
46 <Tool
47 Name="VCPreLinkEventTool"/>
48 <Tool
49 Name="VCResourceCompilerTool"/>
50 <Tool
51 Name="VCWebServiceProxyGeneratorTool"/>
52 <Tool
53 Name="VCXMLDataGeneratorTool"/>
54 <Tool
55 Name="VCManagedWrapperGeneratorTool"/>
56 <Tool
57 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
58 </Configuration>
59 <Configuration
60 Name="Release|Win32"
61 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
62 IntermediateDirectory="Release"
63 ConfigurationType="4"
64 CharacterSet="1">
65 <Tool
66 Name="VCCLCompilerTool"
67 AdditionalOptions="/Oy-"
68 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
69 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
70 RuntimeLibrary="0"
71 StructMemberAlignment="0"
72 ForceConformanceInForLoopScope="TRUE"
73 UsePrecompiledHeader="0"
74 WarningLevel="3"
75 WarnAsError="TRUE"
76 Detect64BitPortabilityProblems="FALSE"
77 DebugInformationFormat="3"/>
78 <Tool
79 Name="VCCustomBuildTool"/>
80 <Tool
81 Name="VCLibrarianTool"
82 OutputFile="$(OutDir)/llmessage.lib"/>
83 <Tool
84 Name="VCMIDLTool"/>
85 <Tool
86 Name="VCPostBuildEventTool"/>
87 <Tool
88 Name="VCPreBuildEventTool"/>
89 <Tool
90 Name="VCPreLinkEventTool"/>
91 <Tool
92 Name="VCResourceCompilerTool"/>
93 <Tool
94 Name="VCWebServiceProxyGeneratorTool"/>
95 <Tool
96 Name="VCXMLDataGeneratorTool"/>
97 <Tool
98 Name="VCManagedWrapperGeneratorTool"/>
99 <Tool
100 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
101 </Configuration>
102 <Configuration
103 Name="ReleaseNoOpt|Win32"
104 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
105 IntermediateDirectory="$(ConfigurationName)"
106 ConfigurationType="4"
107 CharacterSet="1">
108 <Tool
109 Name="VCCLCompilerTool"
110 AdditionalOptions="/Oy-"
111 Optimization="0"
112 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
113 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
114 RuntimeLibrary="0"
115 StructMemberAlignment="0"
116 ForceConformanceInForLoopScope="TRUE"
117 UsePrecompiledHeader="0"
118 WarningLevel="3"
119 WarnAsError="TRUE"
120 Detect64BitPortabilityProblems="FALSE"
121 DebugInformationFormat="3"/>
122 <Tool
123 Name="VCCustomBuildTool"/>
124 <Tool
125 Name="VCLibrarianTool"
126 OutputFile="$(OutDir)/llmessage.lib"/>
127 <Tool
128 Name="VCMIDLTool"/>
129 <Tool
130 Name="VCPostBuildEventTool"/>
131 <Tool
132 Name="VCPreBuildEventTool"/>
133 <Tool
134 Name="VCPreLinkEventTool"/>
135 <Tool
136 Name="VCResourceCompilerTool"/>
137 <Tool
138 Name="VCWebServiceProxyGeneratorTool"/>
139 <Tool
140 Name="VCXMLDataGeneratorTool"/>
141 <Tool
142 Name="VCManagedWrapperGeneratorTool"/>
143 <Tool
144 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
145 </Configuration>
146 </Configurations>
147 <References>
148 </References>
149 <Files>
150 <Filter
151 Name="Source Files"
152 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
153 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
154 <File
155 RelativePath=".\llassetstorage.cpp">
156 </File>
157 <File
158 RelativePath=".\llblowfishcipher.cpp">
159 </File>
160 <File
161 RelativePath=".\llbuffer.cpp">
162 </File>
163 <File
164 RelativePath=".\llbufferstream.cpp">
165 </File>
166 <File
167 RelativePath=".\llcachename.cpp">
168 </File>
169 <File
170 RelativePath=".\llchainio.cpp">
171 </File>
172 <File
173 RelativePath=".\llcircuit.cpp">
174 </File>
175 <File
176 RelativePath=".\llclassifiedflags.cpp">
177 </File>
178 <File
179 RelativePath=".\llcurl.cpp">
180 </File>
181 <File
182 RelativePath=".\lldatapacker.cpp">
183 </File>
184 <File
185 RelativePath=".\lldispatcher.cpp">
186 </File>
187 <File
188 RelativePath=".\llfiltersd2xmlrpc.cpp">
189 </File>
190 <File
191 RelativePath=".\llhost.cpp">
192 </File>
193 <File
194 RelativePath=".\llhttpassetstorage.cpp">
195 </File>
196 <File
197 RelativePath=".\llhttpassetstorage.h">
198 </File>
199 <File
200 RelativePath=".\llhttpclient.cpp">
201 </File>
202 <File
203 RelativePath=".\llhttpnode.cpp">
204 </File>
205 <File
206 RelativePath=".\llhttpsender.cpp">
207 </File>
208 <File
209 RelativePath=".\llinstantmessage.cpp">
210 </File>
211 <File
212 RelativePath=".\lliobuffer.cpp">
213 </File>
214 <File
215 RelativePath=".\lliohttpserver.cpp">
216 </File>
217 <File
218 RelativePath=".\lliopipe.cpp">
219 </File>
220 <File
221 RelativePath=".\lliosocket.cpp">
222 </File>
223 <File
224 RelativePath=".\llioutil.cpp">
225 </File>
226 <File
227 RelativePath=".\llmail.cpp">
228 </File>
229 <File
230 RelativePath=".\llmessagebuilder.cpp">
231 </File>
232 <File
233 RelativePath=".\llmessageconfig.cpp">
234 </File>
235 <File
236 RelativePath=".\llmessagereader.cpp">
237 </File>
238 <File
239 RelativePath=".\llmessagetemplate.cpp">
240 </File>
241 <File
242 RelativePath=".\llmessagetemplateparser.cpp">
243 </File>
244 <File
245 RelativePath=".\llmessagethrottle.cpp">
246 </File>
247 <File
248 RelativePath=".\llmime.cpp">
249 </File>
250 <File
251 RelativePath=".\llnamevalue.cpp">
252 </File>
253 <File
254 RelativePath=".\llnullcipher.cpp">
255 </File>
256 <File
257 RelativePath=".\llpacketack.cpp">
258 </File>
259 <File
260 RelativePath=".\llpacketbuffer.cpp">
261 </File>
262 <File
263 RelativePath=".\llpacketring.cpp">
264 </File>
265 <File
266 RelativePath=".\llpartdata.cpp">
267 </File>
268 <File
269 RelativePath=".\llpumpio.cpp">
270 </File>
271 <File
272 RelativePath=".\llsdappservices.cpp">
273 </File>
274 <File
275 RelativePath=".\llsdhttpserver.cpp">
276 </File>
277 <File
278 RelativePath=".\llsdmessagebuilder.cpp">
279 </File>
280 <File
281 RelativePath=".\llsdmessagereader.cpp">
282 </File>
283 <File
284 RelativePath=".\llsdrpcclient.cpp">
285 </File>
286 <File
287 RelativePath=".\llsdrpcserver.cpp">
288 </File>
289 <File
290 RelativePath=".\llservice.cpp">
291 </File>
292 <File
293 RelativePath=".\llservicebuilder.cpp">
294 </File>
295 <File
296 RelativePath=".\lltemplatemessagebuilder.cpp">
297 </File>
298 <File
299 RelativePath=".\lltemplatemessagereader.cpp">
300 </File>
301 <File
302 RelativePath=".\llthrottle.cpp">
303 </File>
304 <File
305 RelativePath=".\lltransfermanager.cpp">
306 </File>
307 <File
308 RelativePath=".\lltransfersourceasset.cpp">
309 </File>
310 <File
311 RelativePath=".\lltransfersourcefile.cpp">
312 </File>
313 <File
314 RelativePath=".\lltransfertargetfile.cpp">
315 </File>
316 <File
317 RelativePath=".\lltransfertargetvfile.cpp">
318 </File>
319 <File
320 RelativePath=".\llurlrequest.cpp">
321 </File>
322 <File
323 RelativePath=".\lluseroperation.cpp">
324 </File>
325 <File
326 RelativePath=".\llxfer.cpp">
327 </File>
328 <File
329 RelativePath=".\llxfer_file.cpp">
330 </File>
331 <File
332 RelativePath=".\llxfer_mem.cpp">
333 </File>
334 <File
335 RelativePath=".\llxfer_vfile.cpp">
336 </File>
337 <File
338 RelativePath=".\llxfermanager.cpp">
339 </File>
340 <File
341 RelativePath=".\llxorcipher.cpp">
342 </File>
343 <File
344 RelativePath=".\message.cpp">
345 </File>
346 <File
347 RelativePath=".\message_prehash.cpp">
348 </File>
349 <File
350 RelativePath=".\message_string_table.cpp">
351 </File>
352 <File
353 RelativePath=".\net.cpp">
354 </File>
355 <File
356 RelativePath=".\network.cpp">
357 </File>
358 <File
359 RelativePath=".\partsyspacket.cpp">
360 </File>
361 <File
362 RelativePath=".\patch_code.cpp">
363 </File>
364 <File
365 RelativePath=".\patch_dct.cpp">
366 </File>
367 <File
368 RelativePath=".\patch_idct.cpp">
369 </File>
370 </Filter>
371 <Filter
372 Name="Header Files"
373 Filter="h;hpp;hxx;hm;inl;inc;xsd"
374 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
375 <File
376 RelativePath=".\camera.h">
377 </File>
378 <File
379 RelativePath=".\coordframe.h">
380 </File>
381 <File
382 RelativePath=".\llassetstorage.h">
383 </File>
384 <File
385 RelativePath=".\llblowfishcipher.h">
386 </File>
387 <File
388 RelativePath=".\llbuffer.h">
389 </File>
390 <File
391 RelativePath=".\llbufferstream.h">
392 </File>
393 <File
394 RelativePath=".\llcachename.h">
395 </File>
396 <File
397 RelativePath=".\llcamera.h">
398 </File>
399 <File
400 RelativePath=".\llchainio.h">
401 </File>
402 <File
403 RelativePath=".\llcipher.h">
404 </File>
405 <File
406 RelativePath=".\llcircuit.h">
407 </File>
408 <File
409 RelativePath=".\llclassifiedflags.h">
410 </File>
411 <File
412 RelativePath=".\llcoordframe.h">
413 </File>
414 <File
415 RelativePath=".\llcurl.h">
416 </File>
417 <File
418 RelativePath=".\lldatapacker.h">
419 </File>
420 <File
421 RelativePath=".\lldbstrings.h">
422 </File>
423 <File
424 RelativePath=".\lldispatcher.h">
425 </File>
426 <File
427 RelativePath=".\lleventflags.h">
428 </File>
429 <File
430 RelativePath=".\llfiltersd2xmlrpc.h">
431 </File>
432 <File
433 RelativePath=".\llfollowcamparams.h">
434 </File>
435 <File
436 RelativePath=".\llhost.h">
437 </File>
438 <File
439 RelativePath=".\llhttpclient.h">
440 </File>
441 <File
442 RelativePath=".\llhttpnode.h">
443 </File>
444 <File
445 RelativePath=".\llhttpsender.h">
446 </File>
447 <File
448 RelativePath=".\llinstantmessage.h">
449 </File>
450 <File
451 RelativePath=".\llinvite.h">
452 </File>
453 <File
454 RelativePath=".\lliobuffer.h">
455 </File>
456 <File
457 RelativePath=".\lliohttpserver.h">
458 </File>
459 <File
460 RelativePath=".\lliopipe.h">
461 </File>
462 <File
463 RelativePath=".\lliosocket.h">
464 </File>
465 <File
466 RelativePath=".\llioutil.h">
467 </File>
468 <File
469 RelativePath=".\llloginflags.h">
470 </File>
471 <File
472 RelativePath=".\lllsltransmit.h">
473 </File>
474 <File
475 RelativePath=".\llmail.h">
476 </File>
477 <File
478 RelativePath=".\llmessagebuilder.h">
479 </File>
480 <File
481 RelativePath=".\llmessageconfig.h">
482 </File>
483 <File
484 RelativePath=".\llmessagereader.h">
485 </File>
486 <File
487 RelativePath=".\llmessagetemplate.h">
488 </File>
489 <File
490 RelativePath=".\llmessagetemplateparser.h">
491 </File>
492 <File
493 RelativePath=".\llmessagethrottle.h">
494 </File>
495 <File
496 RelativePath=".\llmime.h">
497 </File>
498 <File
499 RelativePath=".\llnamevalue.h">
500 </File>
501 <File
502 RelativePath=".\llnullcipher.h">
503 </File>
504 <File
505 RelativePath=".\llpacketack.h">
506 </File>
507 <File
508 RelativePath=".\llpacketbuffer.h">
509 </File>
510 <File
511 RelativePath=".\llpacketring.h">
512 </File>
513 <File
514 RelativePath=".\llpartdata.h">
515 </File>
516 <File
517 RelativePath=".\llpumpio.h">
518 </File>
519 <File
520 RelativePath=".\llqueryflags.h">
521 </File>
522 <File
523 RelativePath=".\llregionflags.h">
524 </File>
525 <File
526 RelativePath=".\llregionhandle.h">
527 </File>
528 <File
529 RelativePath=".\llsdappservices.h">
530 </File>
531 <File
532 RelativePath=".\llsdhttpserver.h">
533 </File>
534 <File
535 RelativePath=".\llsdmessagebuilder.h">
536 </File>
537 <File
538 RelativePath=".\llsdmessagereader.h">
539 </File>
540 <File
541 RelativePath=".\llsdrpcclient.h">
542 </File>
543 <File
544 RelativePath=".\llsdrpcserver.h">
545 </File>
546 <File
547 RelativePath=".\llservice.h">
548 </File>
549 <File
550 RelativePath=".\llservicebuilder.h">
551 </File>
552 <File
553 RelativePath=".\lltaskname.h">
554 </File>
555 <File
556 RelativePath=".\llteleportflags.h">
557 </File>
558 <File
559 RelativePath=".\lltemplatemessagebuilder.h">
560 </File>
561 <File
562 RelativePath=".\lltemplatemessagereader.h">
563 </File>
564 <File
565 RelativePath=".\llthrottle.h">
566 </File>
567 <File
568 RelativePath=".\lltransfermanager.h">
569 </File>
570 <File
571 RelativePath=".\lltransfersourceasset.h">
572 </File>
573 <File
574 RelativePath=".\lltransfersourcefile.h">
575 </File>
576 <File
577 RelativePath=".\lltransfertargetfile.h">
578 </File>
579 <File
580 RelativePath=".\lltransfertargetvfile.h">
581 </File>
582 <File
583 RelativePath=".\llurlrequest.h">
584 </File>
585 <File
586 RelativePath=".\lluseroperation.h">
587 </File>
588 <File
589 RelativePath=".\llvehicleparams.h">
590 </File>
591 <File
592 RelativePath=".\llxfer.h">
593 </File>
594 <File
595 RelativePath=".\llxfer_file.h">
596 </File>
597 <File
598 RelativePath=".\llxfer_mem.h">
599 </File>
600 <File
601 RelativePath=".\llxfer_vfile.h">
602 </File>
603 <File
604 RelativePath=".\llxfermanager.h">
605 </File>
606 <File
607 RelativePath=".\llxorcipher.h">
608 </File>
609 <File
610 RelativePath=".\machine.h">
611 </File>
612 <File
613 RelativePath=".\mean_collision_data.h">
614 </File>
615 <File
616 RelativePath=".\message.h">
617 </File>
618 <File
619 RelativePath=".\message_prehash.h">
620 </File>
621 <File
622 RelativePath=".\net.h">
623 </File>
624 <File
625 RelativePath=".\network.h">
626 </File>
627 <File
628 RelativePath=".\partsyspacket.h">
629 </File>
630 <File
631 RelativePath=".\patch_code.h">
632 </File>
633 <File
634 RelativePath=".\patch_dct.h">
635 </File>
636 <File
637 RelativePath=".\sound_ids.h">
638 </File>
639 </Filter>
640 <Filter
641 Name="Resource Files"
642 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
643 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
644 </Filter>
645 <File
646 RelativePath="..\..\scripts\messages\message_template.msg">
647 <FileConfiguration
648 Name="Debug|Win32">
649 <Tool
650 Name="VCCustomBuildTool"
651 Description=""
652 CommandLine=""
653 Outputs=""/>
654 </FileConfiguration>
655 <FileConfiguration
656 Name="Release|Win32">
657 <Tool
658 Name="VCCustomBuildTool"
659 Description=""
660 CommandLine=""
661 Outputs=""/>
662 </FileConfiguration>
663 <FileConfiguration
664 Name="ReleaseNoOpt|Win32">
665 <Tool
666 Name="VCCustomBuildTool"
667 Description=""
668 CommandLine=""
669 Outputs=""/>
670 </FileConfiguration>
671 </File>
672 </Files>
673 <Globals>
674 </Globals>
675</VisualStudioProject>
diff --git a/linden/indra/llmessage/llmessage_vc8.vcproj b/linden/indra/llmessage/llmessage_vc8.vcproj
deleted file mode 100644
index 96f81f7..0000000
--- a/linden/indra/llmessage/llmessage_vc8.vcproj
+++ /dev/null
@@ -1,921 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8.00"
5 Name="llmessage"
6 ProjectGUID="{E5D94794-5671-4BD6-A16D-26EC18F3DB34}"
7 RootNamespace="llmessage"
8 Keyword="Win32Proj"
9 >
10 <Platforms>
11 <Platform
12 Name="Win32"
13 />
14 </Platforms>
15 <ToolFiles>
16 </ToolFiles>
17 <Configurations>
18 <Configuration
19 Name="Debug|Win32"
20 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
21 IntermediateDirectory="Debug"
22 ConfigurationType="4"
23 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
24 CharacterSet="1"
25 >
26 <Tool
27 Name="VCPreBuildEventTool"
28 />
29 <Tool
30 Name="VCCustomBuildTool"
31 />
32 <Tool
33 Name="VCXMLDataGeneratorTool"
34 />
35 <Tool
36 Name="VCWebServiceProxyGeneratorTool"
37 />
38 <Tool
39 Name="VCMIDLTool"
40 />
41 <Tool
42 Name="VCCLCompilerTool"
43 Optimization="0"
44 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
45 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
46 MinimalRebuild="true"
47 BasicRuntimeChecks="3"
48 RuntimeLibrary="1"
49 StructMemberAlignment="4"
50 TreatWChar_tAsBuiltInType="false"
51 ForceConformanceInForLoopScope="true"
52 UsePrecompiledHeader="0"
53 WarningLevel="3"
54 WarnAsError="true"
55 Detect64BitPortabilityProblems="false"
56 DebugInformationFormat="4"
57 />
58 <Tool
59 Name="VCManagedResourceCompilerTool"
60 />
61 <Tool
62 Name="VCResourceCompilerTool"
63 />
64 <Tool
65 Name="VCPreLinkEventTool"
66 />
67 <Tool
68 Name="VCLibrarianTool"
69 OutputFile="$(OutDir)/llmessage.lib"
70 />
71 <Tool
72 Name="VCALinkTool"
73 />
74 <Tool
75 Name="VCXDCMakeTool"
76 />
77 <Tool
78 Name="VCBscMakeTool"
79 />
80 <Tool
81 Name="VCFxCopTool"
82 />
83 <Tool
84 Name="VCPostBuildEventTool"
85 />
86 </Configuration>
87 <Configuration
88 Name="Release|Win32"
89 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
90 IntermediateDirectory="Release"
91 ConfigurationType="4"
92 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
93 CharacterSet="1"
94 >
95 <Tool
96 Name="VCPreBuildEventTool"
97 />
98 <Tool
99 Name="VCCustomBuildTool"
100 />
101 <Tool
102 Name="VCXMLDataGeneratorTool"
103 />
104 <Tool
105 Name="VCWebServiceProxyGeneratorTool"
106 />
107 <Tool
108 Name="VCMIDLTool"
109 />
110 <Tool
111 Name="VCCLCompilerTool"
112 AdditionalOptions="/Oy-"
113 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
114 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
115 RuntimeLibrary="0"
116 StructMemberAlignment="0"
117 TreatWChar_tAsBuiltInType="false"
118 ForceConformanceInForLoopScope="true"
119 UsePrecompiledHeader="0"
120 WarningLevel="3"
121 WarnAsError="true"
122 Detect64BitPortabilityProblems="false"
123 DebugInformationFormat="3"
124 />
125 <Tool
126 Name="VCManagedResourceCompilerTool"
127 />
128 <Tool
129 Name="VCResourceCompilerTool"
130 />
131 <Tool
132 Name="VCPreLinkEventTool"
133 />
134 <Tool
135 Name="VCLibrarianTool"
136 OutputFile="$(OutDir)/llmessage.lib"
137 />
138 <Tool
139 Name="VCALinkTool"
140 />
141 <Tool
142 Name="VCXDCMakeTool"
143 />
144 <Tool
145 Name="VCBscMakeTool"
146 />
147 <Tool
148 Name="VCFxCopTool"
149 />
150 <Tool
151 Name="VCPostBuildEventTool"
152 />
153 </Configuration>
154 <Configuration
155 Name="ReleaseNoOpt|Win32"
156 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
157 IntermediateDirectory="$(ConfigurationName)"
158 ConfigurationType="4"
159 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
160 CharacterSet="1"
161 >
162 <Tool
163 Name="VCPreBuildEventTool"
164 />
165 <Tool
166 Name="VCCustomBuildTool"
167 />
168 <Tool
169 Name="VCXMLDataGeneratorTool"
170 />
171 <Tool
172 Name="VCWebServiceProxyGeneratorTool"
173 />
174 <Tool
175 Name="VCMIDLTool"
176 />
177 <Tool
178 Name="VCCLCompilerTool"
179 AdditionalOptions="/Oy-"
180 Optimization="0"
181 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
182 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
183 RuntimeLibrary="0"
184 StructMemberAlignment="0"
185 TreatWChar_tAsBuiltInType="false"
186 ForceConformanceInForLoopScope="true"
187 UsePrecompiledHeader="0"
188 WarningLevel="3"
189 WarnAsError="true"
190 Detect64BitPortabilityProblems="false"
191 DebugInformationFormat="3"
192 />
193 <Tool
194 Name="VCManagedResourceCompilerTool"
195 />
196 <Tool
197 Name="VCResourceCompilerTool"
198 />
199 <Tool
200 Name="VCPreLinkEventTool"
201 />
202 <Tool
203 Name="VCLibrarianTool"
204 OutputFile="$(OutDir)/llmessage.lib"
205 />
206 <Tool
207 Name="VCALinkTool"
208 />
209 <Tool
210 Name="VCXDCMakeTool"
211 />
212 <Tool
213 Name="VCBscMakeTool"
214 />
215 <Tool
216 Name="VCFxCopTool"
217 />
218 <Tool
219 Name="VCPostBuildEventTool"
220 />
221 </Configuration>
222 </Configurations>
223 <References>
224 </References>
225 <Files>
226 <Filter
227 Name="Source Files"
228 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
229 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
230 >
231 <File
232 RelativePath=".\llassetstorage.cpp"
233 >
234 </File>
235 <File
236 RelativePath=".\llblowfishcipher.cpp"
237 >
238 </File>
239 <File
240 RelativePath=".\llbuffer.cpp"
241 >
242 </File>
243 <File
244 RelativePath=".\llbufferstream.cpp"
245 >
246 </File>
247 <File
248 RelativePath=".\llcachename.cpp"
249 >
250 </File>
251 <File
252 RelativePath=".\llchainio.cpp"
253 >
254 </File>
255 <File
256 RelativePath=".\llcircuit.cpp"
257 >
258 </File>
259 <File
260 RelativePath=".\llclassifiedflags.cpp"
261 >
262 </File>
263 <File
264 RelativePath=".\llcurl.cpp"
265 >
266 </File>
267 <File
268 RelativePath=".\lldatapacker.cpp"
269 >
270 </File>
271 <File
272 RelativePath=".\lldispatcher.cpp"
273 >
274 </File>
275 <File
276 RelativePath=".\llfiltersd2xmlrpc.cpp"
277 >
278 </File>
279 <File
280 RelativePath=".\llhost.cpp"
281 >
282 </File>
283 <File
284 RelativePath=".\llhttpassetstorage.cpp"
285 >
286 </File>
287 <File
288 RelativePath=".\llhttpassetstorage.h"
289 >
290 </File>
291 <File
292 RelativePath=".\llhttpclient.cpp"
293 >
294 </File>
295 <File
296 RelativePath=".\llhttpnode.cpp"
297 >
298 </File>
299 <File
300 RelativePath=".\llhttpsender.cpp"
301 >
302 </File>
303 <File
304 RelativePath=".\llinstantmessage.cpp"
305 >
306 </File>
307 <File
308 RelativePath=".\lliobuffer.cpp"
309 >
310 </File>
311 <File
312 RelativePath=".\lliohttpserver.cpp"
313 >
314 </File>
315 <File
316 RelativePath=".\lliopipe.cpp"
317 >
318 </File>
319 <File
320 RelativePath=".\lliosocket.cpp"
321 >
322 </File>
323 <File
324 RelativePath=".\llioutil.cpp"
325 >
326 </File>
327 <File
328 RelativePath=".\llmail.cpp"
329 >
330 </File>
331 <File
332 RelativePath=".\llmessagebuilder.cpp"
333 >
334 </File>
335 <File
336 RelativePath=".\llmessageconfig.cpp"
337 >
338 </File>
339 <File
340 RelativePath=".\llmessagereader.cpp"
341 >
342 </File>
343 <File
344 RelativePath=".\llmessagetemplate.cpp"
345 >
346 </File>
347 <File
348 RelativePath=".\llmessagetemplateparser.cpp"
349 >
350 </File>
351 <File
352 RelativePath=".\llmessagethrottle.cpp"
353 >
354 </File>
355 <File
356 RelativePath=".\llmime.cpp"
357 >
358 </File>
359 <File
360 RelativePath=".\llnamevalue.cpp"
361 >
362 </File>
363 <File
364 RelativePath=".\llnullcipher.cpp"
365 >
366 </File>
367 <File
368 RelativePath=".\llpacketack.cpp"
369 >
370 </File>
371 <File
372 RelativePath=".\llpacketbuffer.cpp"
373 >
374 </File>
375 <File
376 RelativePath=".\llpacketring.cpp"
377 >
378 </File>
379 <File
380 RelativePath=".\llpartdata.cpp"
381 >
382 </File>
383 <File
384 RelativePath=".\llpumpio.cpp"
385 >
386 </File>
387 <File
388 RelativePath=".\llsdappservices.cpp"
389 >
390 </File>
391 <File
392 RelativePath=".\llsdhttpserver.cpp"
393 >
394 </File>
395 <File
396 RelativePath=".\llsdmessagebuilder.cpp"
397 >
398 </File>
399 <File
400 RelativePath=".\llsdmessagereader.cpp"
401 >
402 </File>
403 <File
404 RelativePath=".\llsdrpcclient.cpp"
405 >
406 </File>
407 <File
408 RelativePath=".\llsdrpcserver.cpp"
409 >
410 </File>
411 <File
412 RelativePath=".\llservice.cpp"
413 >
414 </File>
415 <File
416 RelativePath=".\llservicebuilder.cpp"
417 >
418 </File>
419 <File
420 RelativePath=".\lltemplatemessagebuilder.cpp"
421 >
422 </File>
423 <File
424 RelativePath=".\lltemplatemessagereader.cpp"
425 >
426 </File>
427 <File
428 RelativePath=".\llthrottle.cpp"
429 >
430 </File>
431 <File
432 RelativePath=".\lltransfermanager.cpp"
433 >
434 </File>
435 <File
436 RelativePath=".\lltransfersourceasset.cpp"
437 >
438 </File>
439 <File
440 RelativePath=".\lltransfersourcefile.cpp"
441 >
442 </File>
443 <File
444 RelativePath=".\lltransfertargetfile.cpp"
445 >
446 </File>
447 <File
448 RelativePath=".\lltransfertargetvfile.cpp"
449 >
450 </File>
451 <File
452 RelativePath=".\llurlrequest.cpp"
453 >
454 </File>
455 <File
456 RelativePath=".\lluseroperation.cpp"
457 >
458 </File>
459 <File
460 RelativePath=".\llxfer.cpp"
461 >
462 </File>
463 <File
464 RelativePath=".\llxfer_file.cpp"
465 >
466 </File>
467 <File
468 RelativePath=".\llxfer_mem.cpp"
469 >
470 </File>
471 <File
472 RelativePath=".\llxfer_vfile.cpp"
473 >
474 </File>
475 <File
476 RelativePath=".\llxfermanager.cpp"
477 >
478 </File>
479 <File
480 RelativePath=".\llxorcipher.cpp"
481 >
482 </File>
483 <File
484 RelativePath=".\message.cpp"
485 >
486 </File>
487 <File
488 RelativePath=".\message_prehash.cpp"
489 >
490 </File>
491 <File
492 RelativePath=".\message_string_table.cpp"
493 >
494 </File>
495 <File
496 RelativePath=".\net.cpp"
497 >
498 </File>
499 <File
500 RelativePath=".\network.cpp"
501 >
502 </File>
503 <File
504 RelativePath=".\partsyspacket.cpp"
505 >
506 </File>
507 <File
508 RelativePath=".\patch_code.cpp"
509 >
510 </File>
511 <File
512 RelativePath=".\patch_dct.cpp"
513 >
514 </File>
515 <File
516 RelativePath=".\patch_idct.cpp"
517 >
518 </File>
519 </Filter>
520 <Filter
521 Name="Header Files"
522 Filter="h;hpp;hxx;hm;inl;inc;xsd"
523 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
524 >
525 <File
526 RelativePath=".\camera.h"
527 >
528 </File>
529 <File
530 RelativePath=".\coordframe.h"
531 >
532 </File>
533 <File
534 RelativePath=".\llassetstorage.h"
535 >
536 </File>
537 <File
538 RelativePath=".\llblowfishcipher.h"
539 >
540 </File>
541 <File
542 RelativePath=".\llbuffer.h"
543 >
544 </File>
545 <File
546 RelativePath=".\llbufferstream.h"
547 >
548 </File>
549 <File
550 RelativePath=".\llcachename.h"
551 >
552 </File>
553 <File
554 RelativePath=".\llcamera.h"
555 >
556 </File>
557 <File
558 RelativePath=".\llchainio.h"
559 >
560 </File>
561 <File
562 RelativePath=".\llcipher.h"
563 >
564 </File>
565 <File
566 RelativePath=".\llcircuit.h"
567 >
568 </File>
569 <File
570 RelativePath=".\llclassifiedflags.h"
571 >
572 </File>
573 <File
574 RelativePath=".\llcoordframe.h"
575 >
576 </File>
577 <File
578 RelativePath=".\llcurl.h"
579 >
580 </File>
581 <File
582 RelativePath=".\lldatapacker.h"
583 >
584 </File>
585 <File
586 RelativePath=".\lldbstrings.h"
587 >
588 </File>
589 <File
590 RelativePath=".\lldispatcher.h"
591 >
592 </File>
593 <File
594 RelativePath=".\lleventflags.h"
595 >
596 </File>
597 <File
598 RelativePath=".\llfiltersd2xmlrpc.h"
599 >
600 </File>
601 <File
602 RelativePath=".\llfollowcamparams.h"
603 >
604 </File>
605 <File
606 RelativePath=".\llhost.h"
607 >
608 </File>
609 <File
610 RelativePath=".\llhttpclient.h"
611 >
612 </File>
613 <File
614 RelativePath=".\llhttpnode.h"
615 >
616 </File>
617 <File
618 RelativePath=".\llhttpsender.h"
619 >
620 </File>
621 <File
622 RelativePath=".\llinstantmessage.h"
623 >
624 </File>
625 <File
626 RelativePath=".\llinvite.h"
627 >
628 </File>
629 <File
630 RelativePath=".\lliobuffer.h"
631 >
632 </File>
633 <File
634 RelativePath=".\lliohttpserver.h"
635 >
636 </File>
637 <File
638 RelativePath=".\lliopipe.h"
639 >
640 </File>
641 <File
642 RelativePath=".\lliosocket.h"
643 >
644 </File>
645 <File
646 RelativePath=".\llioutil.h"
647 >
648 </File>
649 <File
650 RelativePath=".\llloginflags.h"
651 >
652 </File>
653 <File
654 RelativePath=".\lllsltransmit.h"
655 >
656 </File>
657 <File
658 RelativePath=".\llmail.h"
659 >
660 </File>
661 <File
662 RelativePath=".\llmessagebuilder.h"
663 >
664 </File>
665 <File
666 RelativePath=".\llmessageconfig.h"
667 >
668 </File>
669 <File
670 RelativePath=".\llmessagereader.h"
671 >
672 </File>
673 <File
674 RelativePath=".\llmessagetemplate.h"
675 >
676 </File>
677 <File
678 RelativePath=".\llmessagetemplateparser.h"
679 >
680 </File>
681 <File
682 RelativePath=".\llmessagethrottle.h"
683 >
684 </File>
685 <File
686 RelativePath=".\llmime.h"
687 >
688 </File>
689 <File
690 RelativePath=".\llnamevalue.h"
691 >
692 </File>
693 <File
694 RelativePath=".\llnullcipher.h"
695 >
696 </File>
697 <File
698 RelativePath=".\llpacketack.h"
699 >
700 </File>
701 <File
702 RelativePath=".\llpacketbuffer.h"
703 >
704 </File>
705 <File
706 RelativePath=".\llpacketring.h"
707 >
708 </File>
709 <File
710 RelativePath=".\llpartdata.h"
711 >
712 </File>
713 <File
714 RelativePath=".\llpumpio.h"
715 >
716 </File>
717 <File
718 RelativePath=".\llqueryflags.h"
719 >
720 </File>
721 <File
722 RelativePath=".\llregionflags.h"
723 >
724 </File>
725 <File
726 RelativePath=".\llregionhandle.h"
727 >
728 </File>
729 <File
730 RelativePath=".\llsdappservices.h"
731 >
732 </File>
733 <File
734 RelativePath=".\llsdhttpserver.h"
735 >
736 </File>
737 <File
738 RelativePath=".\llsdmessagebuilder.h"
739 >
740 </File>
741 <File
742 RelativePath=".\llsdmessagereader.h"
743 >
744 </File>
745 <File
746 RelativePath=".\llsdrpcclient.h"
747 >
748 </File>
749 <File
750 RelativePath=".\llsdrpcserver.h"
751 >
752 </File>
753 <File
754 RelativePath=".\llservice.h"
755 >
756 </File>
757 <File
758 RelativePath=".\llservicebuilder.h"
759 >
760 </File>
761 <File
762 RelativePath=".\lltaskname.h"
763 >
764 </File>
765 <File
766 RelativePath=".\llteleportflags.h"
767 >
768 </File>
769 <File
770 RelativePath=".\lltemplatemessagebuilder.h"
771 >
772 </File>
773 <File
774 RelativePath=".\lltemplatemessagereader.h"
775 >
776 </File>
777 <File
778 RelativePath=".\llthrottle.h"
779 >
780 </File>
781 <File
782 RelativePath=".\lltransfermanager.h"
783 >
784 </File>
785 <File
786 RelativePath=".\lltransfersourceasset.h"
787 >
788 </File>
789 <File
790 RelativePath=".\lltransfersourcefile.h"
791 >
792 </File>
793 <File
794 RelativePath=".\lltransfertargetfile.h"
795 >
796 </File>
797 <File
798 RelativePath=".\lltransfertargetvfile.h"
799 >
800 </File>
801 <File
802 RelativePath=".\llurlrequest.h"
803 >
804 </File>
805 <File
806 RelativePath=".\lluseroperation.h"
807 >
808 </File>
809 <File
810 RelativePath=".\llvehicleparams.h"
811 >
812 </File>
813 <File
814 RelativePath=".\llxfer.h"
815 >
816 </File>
817 <File
818 RelativePath=".\llxfer_file.h"
819 >
820 </File>
821 <File
822 RelativePath=".\llxfer_mem.h"
823 >
824 </File>
825 <File
826 RelativePath=".\llxfer_vfile.h"
827 >
828 </File>
829 <File
830 RelativePath=".\llxfermanager.h"
831 >
832 </File>
833 <File
834 RelativePath=".\llxorcipher.h"
835 >
836 </File>
837 <File
838 RelativePath=".\machine.h"
839 >
840 </File>
841 <File
842 RelativePath=".\mean_collision_data.h"
843 >
844 </File>
845 <File
846 RelativePath=".\message.h"
847 >
848 </File>
849 <File
850 RelativePath=".\message_prehash.h"
851 >
852 </File>
853 <File
854 RelativePath=".\net.h"
855 >
856 </File>
857 <File
858 RelativePath=".\network.h"
859 >
860 </File>
861 <File
862 RelativePath=".\partsyspacket.h"
863 >
864 </File>
865 <File
866 RelativePath=".\patch_code.h"
867 >
868 </File>
869 <File
870 RelativePath=".\patch_dct.h"
871 >
872 </File>
873 <File
874 RelativePath=".\sound_ids.h"
875 >
876 </File>
877 </Filter>
878 <Filter
879 Name="Resource Files"
880 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
881 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
882 >
883 </Filter>
884 <File
885 RelativePath="..\..\scripts\messages\message_template.msg"
886 >
887 <FileConfiguration
888 Name="Debug|Win32"
889 >
890 <Tool
891 Name="VCCustomBuildTool"
892 Description=""
893 CommandLine=""
894 Outputs=""
895 />
896 </FileConfiguration>
897 <FileConfiguration
898 Name="Release|Win32"
899 >
900 <Tool
901 Name="VCCustomBuildTool"
902 Description=""
903 CommandLine=""
904 Outputs=""
905 />
906 </FileConfiguration>
907 <FileConfiguration
908 Name="ReleaseNoOpt|Win32"
909 >
910 <Tool
911 Name="VCCustomBuildTool"
912 Description=""
913 CommandLine=""
914 Outputs=""
915 />
916 </FileConfiguration>
917 </File>
918 </Files>
919 <Globals>
920 </Globals>
921</VisualStudioProject>
diff --git a/linden/indra/llmessage/llmessage_vc9.vcproj b/linden/indra/llmessage/llmessage_vc9.vcproj
deleted file mode 100644
index e9f4889..0000000
--- a/linden/indra/llmessage/llmessage_vc9.vcproj
+++ /dev/null
@@ -1,922 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="9.00"
5 Name="llmessage"
6 ProjectGUID="{E5D94794-5671-4BD6-A16D-26EC18F3DB34}"
7 RootNamespace="llmessage"
8 Keyword="Win32Proj"
9 TargetFrameworkVersion="131072"
10 >
11 <Platforms>
12 <Platform
13 Name="Win32"
14 />
15 </Platforms>
16 <ToolFiles>
17 </ToolFiles>
18 <Configurations>
19 <Configuration
20 Name="Debug|Win32"
21 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
22 IntermediateDirectory="Debug"
23 ConfigurationType="4"
24 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
25 CharacterSet="1"
26 >
27 <Tool
28 Name="VCPreBuildEventTool"
29 />
30 <Tool
31 Name="VCCustomBuildTool"
32 />
33 <Tool
34 Name="VCXMLDataGeneratorTool"
35 />
36 <Tool
37 Name="VCWebServiceProxyGeneratorTool"
38 />
39 <Tool
40 Name="VCMIDLTool"
41 />
42 <Tool
43 Name="VCCLCompilerTool"
44 Optimization="0"
45 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
46 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
47 MinimalRebuild="true"
48 BasicRuntimeChecks="3"
49 RuntimeLibrary="1"
50 StructMemberAlignment="4"
51 TreatWChar_tAsBuiltInType="false"
52 ForceConformanceInForLoopScope="true"
53 UsePrecompiledHeader="0"
54 WarningLevel="3"
55 WarnAsError="true"
56 Detect64BitPortabilityProblems="false"
57 DebugInformationFormat="4"
58 />
59 <Tool
60 Name="VCManagedResourceCompilerTool"
61 />
62 <Tool
63 Name="VCResourceCompilerTool"
64 />
65 <Tool
66 Name="VCPreLinkEventTool"
67 />
68 <Tool
69 Name="VCLibrarianTool"
70 OutputFile="$(OutDir)/llmessage.lib"
71 />
72 <Tool
73 Name="VCALinkTool"
74 />
75 <Tool
76 Name="VCXDCMakeTool"
77 />
78 <Tool
79 Name="VCBscMakeTool"
80 />
81 <Tool
82 Name="VCFxCopTool"
83 />
84 <Tool
85 Name="VCPostBuildEventTool"
86 />
87 </Configuration>
88 <Configuration
89 Name="Release|Win32"
90 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
91 IntermediateDirectory="Release"
92 ConfigurationType="4"
93 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
94 CharacterSet="1"
95 >
96 <Tool
97 Name="VCPreBuildEventTool"
98 />
99 <Tool
100 Name="VCCustomBuildTool"
101 />
102 <Tool
103 Name="VCXMLDataGeneratorTool"
104 />
105 <Tool
106 Name="VCWebServiceProxyGeneratorTool"
107 />
108 <Tool
109 Name="VCMIDLTool"
110 />
111 <Tool
112 Name="VCCLCompilerTool"
113 AdditionalOptions="/Oy-"
114 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
115 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
116 RuntimeLibrary="0"
117 StructMemberAlignment="0"
118 TreatWChar_tAsBuiltInType="false"
119 ForceConformanceInForLoopScope="true"
120 UsePrecompiledHeader="0"
121 WarningLevel="3"
122 WarnAsError="true"
123 Detect64BitPortabilityProblems="false"
124 DebugInformationFormat="3"
125 />
126 <Tool
127 Name="VCManagedResourceCompilerTool"
128 />
129 <Tool
130 Name="VCResourceCompilerTool"
131 />
132 <Tool
133 Name="VCPreLinkEventTool"
134 />
135 <Tool
136 Name="VCLibrarianTool"
137 OutputFile="$(OutDir)/llmessage.lib"
138 />
139 <Tool
140 Name="VCALinkTool"
141 />
142 <Tool
143 Name="VCXDCMakeTool"
144 />
145 <Tool
146 Name="VCBscMakeTool"
147 />
148 <Tool
149 Name="VCFxCopTool"
150 />
151 <Tool
152 Name="VCPostBuildEventTool"
153 />
154 </Configuration>
155 <Configuration
156 Name="ReleaseNoOpt|Win32"
157 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
158 IntermediateDirectory="$(ConfigurationName)"
159 ConfigurationType="4"
160 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
161 CharacterSet="1"
162 >
163 <Tool
164 Name="VCPreBuildEventTool"
165 />
166 <Tool
167 Name="VCCustomBuildTool"
168 />
169 <Tool
170 Name="VCXMLDataGeneratorTool"
171 />
172 <Tool
173 Name="VCWebServiceProxyGeneratorTool"
174 />
175 <Tool
176 Name="VCMIDLTool"
177 />
178 <Tool
179 Name="VCCLCompilerTool"
180 AdditionalOptions="/Oy-"
181 Optimization="0"
182 AdditionalIncludeDirectories="..\llcommon;..\llmath;..\llvfs;..\..\libraries\i686-win32\include;..\..\libraries\include\"
183 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
184 RuntimeLibrary="0"
185 StructMemberAlignment="0"
186 TreatWChar_tAsBuiltInType="false"
187 ForceConformanceInForLoopScope="true"
188 UsePrecompiledHeader="0"
189 WarningLevel="3"
190 WarnAsError="true"
191 Detect64BitPortabilityProblems="false"
192 DebugInformationFormat="3"
193 />
194 <Tool
195 Name="VCManagedResourceCompilerTool"
196 />
197 <Tool
198 Name="VCResourceCompilerTool"
199 />
200 <Tool
201 Name="VCPreLinkEventTool"
202 />
203 <Tool
204 Name="VCLibrarianTool"
205 OutputFile="$(OutDir)/llmessage.lib"
206 />
207 <Tool
208 Name="VCALinkTool"
209 />
210 <Tool
211 Name="VCXDCMakeTool"
212 />
213 <Tool
214 Name="VCBscMakeTool"
215 />
216 <Tool
217 Name="VCFxCopTool"
218 />
219 <Tool
220 Name="VCPostBuildEventTool"
221 />
222 </Configuration>
223 </Configurations>
224 <References>
225 </References>
226 <Files>
227 <Filter
228 Name="Source Files"
229 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
230 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
231 >
232 <File
233 RelativePath=".\llassetstorage.cpp"
234 >
235 </File>
236 <File
237 RelativePath=".\llblowfishcipher.cpp"
238 >
239 </File>
240 <File
241 RelativePath=".\llbuffer.cpp"
242 >
243 </File>
244 <File
245 RelativePath=".\llbufferstream.cpp"
246 >
247 </File>
248 <File
249 RelativePath=".\llcachename.cpp"
250 >
251 </File>
252 <File
253 RelativePath=".\llchainio.cpp"
254 >
255 </File>
256 <File
257 RelativePath=".\llcircuit.cpp"
258 >
259 </File>
260 <File
261 RelativePath=".\llclassifiedflags.cpp"
262 >
263 </File>
264 <File
265 RelativePath=".\llcurl.cpp"
266 >
267 </File>
268 <File
269 RelativePath=".\lldatapacker.cpp"
270 >
271 </File>
272 <File
273 RelativePath=".\lldispatcher.cpp"
274 >
275 </File>
276 <File
277 RelativePath=".\llfiltersd2xmlrpc.cpp"
278 >
279 </File>
280 <File
281 RelativePath=".\llhost.cpp"
282 >
283 </File>
284 <File
285 RelativePath=".\llhttpassetstorage.cpp"
286 >
287 </File>
288 <File
289 RelativePath=".\llhttpassetstorage.h"
290 >
291 </File>
292 <File
293 RelativePath=".\llhttpclient.cpp"
294 >
295 </File>
296 <File
297 RelativePath=".\llhttpnode.cpp"
298 >
299 </File>
300 <File
301 RelativePath=".\llhttpsender.cpp"
302 >
303 </File>
304 <File
305 RelativePath=".\llinstantmessage.cpp"
306 >
307 </File>
308 <File
309 RelativePath=".\lliobuffer.cpp"
310 >
311 </File>
312 <File
313 RelativePath=".\lliohttpserver.cpp"
314 >
315 </File>
316 <File
317 RelativePath=".\lliopipe.cpp"
318 >
319 </File>
320 <File
321 RelativePath=".\lliosocket.cpp"
322 >
323 </File>
324 <File
325 RelativePath=".\llioutil.cpp"
326 >
327 </File>
328 <File
329 RelativePath=".\llmail.cpp"
330 >
331 </File>
332 <File
333 RelativePath=".\llmessagebuilder.cpp"
334 >
335 </File>
336 <File
337 RelativePath=".\llmessageconfig.cpp"
338 >
339 </File>
340 <File
341 RelativePath=".\llmessagereader.cpp"
342 >
343 </File>
344 <File
345 RelativePath=".\llmessagetemplate.cpp"
346 >
347 </File>
348 <File
349 RelativePath=".\llmessagetemplateparser.cpp"
350 >
351 </File>
352 <File
353 RelativePath=".\llmessagethrottle.cpp"
354 >
355 </File>
356 <File
357 RelativePath=".\llmime.cpp"
358 >
359 </File>
360 <File
361 RelativePath=".\llnamevalue.cpp"
362 >
363 </File>
364 <File
365 RelativePath=".\llnullcipher.cpp"
366 >
367 </File>
368 <File
369 RelativePath=".\llpacketack.cpp"
370 >
371 </File>
372 <File
373 RelativePath=".\llpacketbuffer.cpp"
374 >
375 </File>
376 <File
377 RelativePath=".\llpacketring.cpp"
378 >
379 </File>
380 <File
381 RelativePath=".\llpartdata.cpp"
382 >
383 </File>
384 <File
385 RelativePath=".\llpumpio.cpp"
386 >
387 </File>
388 <File
389 RelativePath=".\llsdappservices.cpp"
390 >
391 </File>
392 <File
393 RelativePath=".\llsdhttpserver.cpp"
394 >
395 </File>
396 <File
397 RelativePath=".\llsdmessagebuilder.cpp"
398 >
399 </File>
400 <File
401 RelativePath=".\llsdmessagereader.cpp"
402 >
403 </File>
404 <File
405 RelativePath=".\llsdrpcclient.cpp"
406 >
407 </File>
408 <File
409 RelativePath=".\llsdrpcserver.cpp"
410 >
411 </File>
412 <File
413 RelativePath=".\llservice.cpp"
414 >
415 </File>
416 <File
417 RelativePath=".\llservicebuilder.cpp"
418 >
419 </File>
420 <File
421 RelativePath=".\lltemplatemessagebuilder.cpp"
422 >
423 </File>
424 <File
425 RelativePath=".\lltemplatemessagereader.cpp"
426 >
427 </File>
428 <File
429 RelativePath=".\llthrottle.cpp"
430 >
431 </File>
432 <File
433 RelativePath=".\lltransfermanager.cpp"
434 >
435 </File>
436 <File
437 RelativePath=".\lltransfersourceasset.cpp"
438 >
439 </File>
440 <File
441 RelativePath=".\lltransfersourcefile.cpp"
442 >
443 </File>
444 <File
445 RelativePath=".\lltransfertargetfile.cpp"
446 >
447 </File>
448 <File
449 RelativePath=".\lltransfertargetvfile.cpp"
450 >
451 </File>
452 <File
453 RelativePath=".\llurlrequest.cpp"
454 >
455 </File>
456 <File
457 RelativePath=".\lluseroperation.cpp"
458 >
459 </File>
460 <File
461 RelativePath=".\llxfer.cpp"
462 >
463 </File>
464 <File
465 RelativePath=".\llxfer_file.cpp"
466 >
467 </File>
468 <File
469 RelativePath=".\llxfer_mem.cpp"
470 >
471 </File>
472 <File
473 RelativePath=".\llxfer_vfile.cpp"
474 >
475 </File>
476 <File
477 RelativePath=".\llxfermanager.cpp"
478 >
479 </File>
480 <File
481 RelativePath=".\llxorcipher.cpp"
482 >
483 </File>
484 <File
485 RelativePath=".\message.cpp"
486 >
487 </File>
488 <File
489 RelativePath=".\message_prehash.cpp"
490 >
491 </File>
492 <File
493 RelativePath=".\message_string_table.cpp"
494 >
495 </File>
496 <File
497 RelativePath=".\net.cpp"
498 >
499 </File>
500 <File
501 RelativePath=".\network.cpp"
502 >
503 </File>
504 <File
505 RelativePath=".\partsyspacket.cpp"
506 >
507 </File>
508 <File
509 RelativePath=".\patch_code.cpp"
510 >
511 </File>
512 <File
513 RelativePath=".\patch_dct.cpp"
514 >
515 </File>
516 <File
517 RelativePath=".\patch_idct.cpp"
518 >
519 </File>
520 </Filter>
521 <Filter
522 Name="Header Files"
523 Filter="h;hpp;hxx;hm;inl;inc;xsd"
524 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
525 >
526 <File
527 RelativePath=".\camera.h"
528 >
529 </File>
530 <File
531 RelativePath=".\coordframe.h"
532 >
533 </File>
534 <File
535 RelativePath=".\llassetstorage.h"
536 >
537 </File>
538 <File
539 RelativePath=".\llblowfishcipher.h"
540 >
541 </File>
542 <File
543 RelativePath=".\llbuffer.h"
544 >
545 </File>
546 <File
547 RelativePath=".\llbufferstream.h"
548 >
549 </File>
550 <File
551 RelativePath=".\llcachename.h"
552 >
553 </File>
554 <File
555 RelativePath=".\llcamera.h"
556 >
557 </File>
558 <File
559 RelativePath=".\llchainio.h"
560 >
561 </File>
562 <File
563 RelativePath=".\llcipher.h"
564 >
565 </File>
566 <File
567 RelativePath=".\llcircuit.h"
568 >
569 </File>
570 <File
571 RelativePath=".\llclassifiedflags.h"
572 >
573 </File>
574 <File
575 RelativePath=".\llcoordframe.h"
576 >
577 </File>
578 <File
579 RelativePath=".\llcurl.h"
580 >
581 </File>
582 <File
583 RelativePath=".\lldatapacker.h"
584 >
585 </File>
586 <File
587 RelativePath=".\lldbstrings.h"
588 >
589 </File>
590 <File
591 RelativePath=".\lldispatcher.h"
592 >
593 </File>
594 <File
595 RelativePath=".\lleventflags.h"
596 >
597 </File>
598 <File
599 RelativePath=".\llfiltersd2xmlrpc.h"
600 >
601 </File>
602 <File
603 RelativePath=".\llfollowcamparams.h"
604 >
605 </File>
606 <File
607 RelativePath=".\llhost.h"
608 >
609 </File>
610 <File
611 RelativePath=".\llhttpclient.h"
612 >
613 </File>
614 <File
615 RelativePath=".\llhttpnode.h"
616 >
617 </File>
618 <File
619 RelativePath=".\llhttpsender.h"
620 >
621 </File>
622 <File
623 RelativePath=".\llinstantmessage.h"
624 >
625 </File>
626 <File
627 RelativePath=".\llinvite.h"
628 >
629 </File>
630 <File
631 RelativePath=".\lliobuffer.h"
632 >
633 </File>
634 <File
635 RelativePath=".\lliohttpserver.h"
636 >
637 </File>
638 <File
639 RelativePath=".\lliopipe.h"
640 >
641 </File>
642 <File
643 RelativePath=".\lliosocket.h"
644 >
645 </File>
646 <File
647 RelativePath=".\llioutil.h"
648 >
649 </File>
650 <File
651 RelativePath=".\llloginflags.h"
652 >
653 </File>
654 <File
655 RelativePath=".\lllsltransmit.h"
656 >
657 </File>
658 <File
659 RelativePath=".\llmail.h"
660 >
661 </File>
662 <File
663 RelativePath=".\llmessagebuilder.h"
664 >
665 </File>
666 <File
667 RelativePath=".\llmessageconfig.h"
668 >
669 </File>
670 <File
671 RelativePath=".\llmessagereader.h"
672 >
673 </File>
674 <File
675 RelativePath=".\llmessagetemplate.h"
676 >
677 </File>
678 <File
679 RelativePath=".\llmessagetemplateparser.h"
680 >
681 </File>
682 <File
683 RelativePath=".\llmessagethrottle.h"
684 >
685 </File>
686 <File
687 RelativePath=".\llmime.h"
688 >
689 </File>
690 <File
691 RelativePath=".\llnamevalue.h"
692 >
693 </File>
694 <File
695 RelativePath=".\llnullcipher.h"
696 >
697 </File>
698 <File
699 RelativePath=".\llpacketack.h"
700 >
701 </File>
702 <File
703 RelativePath=".\llpacketbuffer.h"
704 >
705 </File>
706 <File
707 RelativePath=".\llpacketring.h"
708 >
709 </File>
710 <File
711 RelativePath=".\llpartdata.h"
712 >
713 </File>
714 <File
715 RelativePath=".\llpumpio.h"
716 >
717 </File>
718 <File
719 RelativePath=".\llqueryflags.h"
720 >
721 </File>
722 <File
723 RelativePath=".\llregionflags.h"
724 >
725 </File>
726 <File
727 RelativePath=".\llregionhandle.h"
728 >
729 </File>
730 <File
731 RelativePath=".\llsdappservices.h"
732 >
733 </File>
734 <File
735 RelativePath=".\llsdhttpserver.h"
736 >
737 </File>
738 <File
739 RelativePath=".\llsdmessagebuilder.h"
740 >
741 </File>
742 <File
743 RelativePath=".\llsdmessagereader.h"
744 >
745 </File>
746 <File
747 RelativePath=".\llsdrpcclient.h"
748 >
749 </File>
750 <File
751 RelativePath=".\llsdrpcserver.h"
752 >
753 </File>
754 <File
755 RelativePath=".\llservice.h"
756 >
757 </File>
758 <File
759 RelativePath=".\llservicebuilder.h"
760 >
761 </File>
762 <File
763 RelativePath=".\lltaskname.h"
764 >
765 </File>
766 <File
767 RelativePath=".\llteleportflags.h"
768 >
769 </File>
770 <File
771 RelativePath=".\lltemplatemessagebuilder.h"
772 >
773 </File>
774 <File
775 RelativePath=".\lltemplatemessagereader.h"
776 >
777 </File>
778 <File
779 RelativePath=".\llthrottle.h"
780 >
781 </File>
782 <File
783 RelativePath=".\lltransfermanager.h"
784 >
785 </File>
786 <File
787 RelativePath=".\lltransfersourceasset.h"
788 >
789 </File>
790 <File
791 RelativePath=".\lltransfersourcefile.h"
792 >
793 </File>
794 <File
795 RelativePath=".\lltransfertargetfile.h"
796 >
797 </File>
798 <File
799 RelativePath=".\lltransfertargetvfile.h"
800 >
801 </File>
802 <File
803 RelativePath=".\llurlrequest.h"
804 >
805 </File>
806 <File
807 RelativePath=".\lluseroperation.h"
808 >
809 </File>
810 <File
811 RelativePath=".\llvehicleparams.h"
812 >
813 </File>
814 <File
815 RelativePath=".\llxfer.h"
816 >
817 </File>
818 <File
819 RelativePath=".\llxfer_file.h"
820 >
821 </File>
822 <File
823 RelativePath=".\llxfer_mem.h"
824 >
825 </File>
826 <File
827 RelativePath=".\llxfer_vfile.h"
828 >
829 </File>
830 <File
831 RelativePath=".\llxfermanager.h"
832 >
833 </File>
834 <File
835 RelativePath=".\llxorcipher.h"
836 >
837 </File>
838 <File
839 RelativePath=".\machine.h"
840 >
841 </File>
842 <File
843 RelativePath=".\mean_collision_data.h"
844 >
845 </File>
846 <File
847 RelativePath=".\message.h"
848 >
849 </File>
850 <File
851 RelativePath=".\message_prehash.h"
852 >
853 </File>
854 <File
855 RelativePath=".\net.h"
856 >
857 </File>
858 <File
859 RelativePath=".\network.h"
860 >
861 </File>
862 <File
863 RelativePath=".\partsyspacket.h"
864 >
865 </File>
866 <File
867 RelativePath=".\patch_code.h"
868 >
869 </File>
870 <File
871 RelativePath=".\patch_dct.h"
872 >
873 </File>
874 <File
875 RelativePath=".\sound_ids.h"
876 >
877 </File>
878 </Filter>
879 <Filter
880 Name="Resource Files"
881 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
882 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
883 >
884 </Filter>
885 <File
886 RelativePath="..\..\scripts\messages\message_template.msg"
887 >
888 <FileConfiguration
889 Name="Debug|Win32"
890 >
891 <Tool
892 Name="VCCustomBuildTool"
893 Description=""
894 CommandLine=""
895 Outputs=""
896 />
897 </FileConfiguration>
898 <FileConfiguration
899 Name="Release|Win32"
900 >
901 <Tool
902 Name="VCCustomBuildTool"
903 Description=""
904 CommandLine=""
905 Outputs=""
906 />
907 </FileConfiguration>
908 <FileConfiguration
909 Name="ReleaseNoOpt|Win32"
910 >
911 <Tool
912 Name="VCCustomBuildTool"
913 Description=""
914 CommandLine=""
915 Outputs=""
916 />
917 </FileConfiguration>
918 </File>
919 </Files>
920 <Globals>
921 </Globals>
922</VisualStudioProject>
diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp
index e23ed07..498cfff 100644
--- a/linden/indra/llmessage/llmessageconfig.cpp
+++ b/linden/indra/llmessage/llmessageconfig.cpp
@@ -52,13 +52,14 @@ static LLSD sMessages;
52class LLMessageConfigFile : public LLLiveFile 52class LLMessageConfigFile : public LLLiveFile
53{ 53{
54public: 54public:
55 LLMessageConfigFile() 55 LLMessageConfigFile() :
56 : LLLiveFile(filename(), messageConfigRefreshRate) 56 LLLiveFile(filename(), messageConfigRefreshRate),
57 mMaxQueuedEvents(0)
57 { } 58 { }
58 59
59 static std::string filename(); 60 static std::string filename();
60 61
61 LLSD mMessages; 62 LLSD mMessages;
62 std::string mServerDefault; 63 std::string mServerDefault;
63 64
64 static LLMessageConfigFile& instance(); 65 static LLMessageConfigFile& instance();
@@ -66,7 +67,7 @@ public:
66 67
67 /* virtual */ void loadFile(); 68 /* virtual */ void loadFile();
68 void loadServerDefaults(const LLSD& data); 69 void loadServerDefaults(const LLSD& data);
69 void loadMaxQueuedEvents(const LLSD& data); 70 void loadMaxQueuedEvents(const LLSD& data);
70 void loadMessages(const LLSD& data); 71 void loadMessages(const LLSD& data);
71 void loadCapBans(const LLSD& blacklist); 72 void loadCapBans(const LLSD& blacklist);
72 void loadMessageBans(const LLSD& blacklist); 73 void loadMessageBans(const LLSD& blacklist);
@@ -74,7 +75,10 @@ public:
74 75
75public: 76public:
76 LLSD mCapBans; 77 LLSD mCapBans;
77 S32 mMaxQueuedEvents; 78 S32 mMaxQueuedEvents;
79
80private:
81 static const S32 DEFAULT_MAX_QUEUED_EVENTS = 100;
78}; 82};
79 83
80std::string LLMessageConfigFile::filename() 84std::string LLMessageConfigFile::filename()
@@ -97,7 +101,7 @@ void LLMessageConfigFile::loadFile()
97{ 101{
98 LLSD data; 102 LLSD data;
99 { 103 {
100 llifstream file(filename().c_str()); 104 llifstream file(filename());
101 105
102 if (file.is_open()) 106 if (file.is_open())
103 { 107 {
@@ -125,7 +129,6 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data)
125 mServerDefault = data["serverDefaults"][sServerName].asString(); 129 mServerDefault = data["serverDefaults"][sServerName].asString();
126} 130}
127 131
128const S32 DEFAULT_MAX_QUEUED_EVENTS = 100;
129void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data) 132void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data)
130{ 133{
131 if (data.has("maxQueuedEvents")) 134 if (data.has("maxQueuedEvents"))
diff --git a/linden/indra/llmessage/llmessagereader.h b/linden/indra/llmessage/llmessagereader.h
index 1e74da9..9fae682 100644
--- a/linden/indra/llmessage/llmessagereader.h
+++ b/linden/indra/llmessage/llmessagereader.h
@@ -69,6 +69,7 @@ class LLMessageReader
69 virtual void getIPAddr(const char *block, const char *var, U32 &ip, S32 blocknum = 0) = 0; 69 virtual void getIPAddr(const char *block, const char *var, U32 &ip, S32 blocknum = 0) = 0;
70 virtual void getIPPort(const char *block, const char *var, U16 &port, S32 blocknum = 0) = 0; 70 virtual void getIPPort(const char *block, const char *var, U16 &port, S32 blocknum = 0) = 0;
71 virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0) = 0; 71 virtual void getString(const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0) = 0;
72 virtual void getString(const char *block, const char *var, std::string& outstr, S32 blocknum = 0) = 0;
72 73
73 virtual S32 getNumberOfBlocks(const char *blockname) = 0; 74 virtual S32 getNumberOfBlocks(const char *blockname) = 0;
74 virtual S32 getSize(const char *blockname, const char *varname) = 0; 75 virtual S32 getSize(const char *blockname, const char *varname) = 0;
diff --git a/linden/indra/llmessage/llmessagetemplateparser.cpp b/linden/indra/llmessage/llmessagetemplateparser.cpp
index 969a0d9..d6adba8 100644
--- a/linden/indra/llmessage/llmessagetemplateparser.cpp
+++ b/linden/indra/llmessage/llmessagetemplateparser.cpp
@@ -161,7 +161,7 @@ S32 get_checker_number(char checker)
161} 161}
162 162
163// check token based on passed simplified regular expression 163// check token based on passed simplified regular expression
164BOOL b_check_token(const char *token, char *regexp) 164BOOL b_check_token(const char *token, const char *regexp)
165{ 165{
166 S32 tptr, rptr = 0; 166 S32 tptr, rptr = 0;
167 S32 current_checker, next_checker = 0; 167 S32 current_checker, next_checker = 0;
diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp
index 84733ba..ad9df26 100644
--- a/linden/indra/llmessage/llmessagethrottle.cpp
+++ b/linden/indra/llmessage/llmessagethrottle.cpp
@@ -110,7 +110,7 @@ void LLMessageThrottle::pruneEntries()
110 } 110 }
111} 111}
112 112
113BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg) 113BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg)
114{ 114{
115 message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); 115 message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]);
116 116
@@ -144,7 +144,7 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg)
144 } 144 }
145} 145}
146 146
147BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const char* mesg) 147BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg)
148{ 148{
149 message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); 149 message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]);
150 150
diff --git a/linden/indra/llmessage/llmessagethrottle.h b/linden/indra/llmessage/llmessagethrottle.h
index 8be08b3..2f27f13 100644
--- a/linden/indra/llmessage/llmessagethrottle.h
+++ b/linden/indra/llmessage/llmessagethrottle.h
@@ -64,8 +64,8 @@ public:
64 LLMessageThrottle(); 64 LLMessageThrottle();
65 ~LLMessageThrottle(); 65 ~LLMessageThrottle();
66 66
67 BOOL addViewerAlert (const LLUUID& to, const char* mesg); 67 BOOL addViewerAlert (const LLUUID& to, const std::string& mesg);
68 BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const char* mesg); 68 BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg);
69 69
70 void pruneEntries(); 70 void pruneEntries();
71 71
diff --git a/linden/indra/llmessage/llmime.cpp b/linden/indra/llmessage/llmime.cpp
index 48e73fb..2093255 100644
--- a/linden/indra/llmessage/llmime.cpp
+++ b/linden/indra/llmessage/llmime.cpp
@@ -439,9 +439,7 @@ bool LLMimeParser::Impl::parseHeaders(
439 std::string value(colon); 439 std::string value(colon);
440 for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii) 440 for(S32 ii = 0; ii < KNOWN_HEADER_COUNT; ++ii)
441 { 441 {
442 if(0 == LLString::compareInsensitive( 442 if(0 == LLStringUtil::compareInsensitive(name, KNOWN_HEADER[ii]))
443 name.c_str(),
444 KNOWN_HEADER[ii].c_str()))
445 { 443 {
446 name = KNOWN_HEADER[ii]; 444 name = KNOWN_HEADER[ii];
447 break; 445 break;
@@ -525,7 +523,7 @@ void LLMimeParser::Impl::scanPastSeparator(
525 { 523 {
526 mContinue = false; 524 mContinue = false;
527 } 525 }
528 if(0 == LLString::compareStrings(mBuffer, separator.c_str())) 526 if(0 == LLStringUtil::compareStrings(std::string(mBuffer), separator))
529 { 527 {
530 found_separator = true; 528 found_separator = true;
531 } 529 }
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
index 18bd5ac..c44f6ce 100644
--- a/linden/indra/llmessage/llnamevalue.cpp
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -155,7 +155,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con
155 else if (!strcmp(mStringType, "U64")) 155 else if (!strcmp(mStringType, "U64"))
156 { 156 {
157 mType = NVT_U64; 157 mType = NVT_U64;
158 mNameValueReference.u64 = new U64(str_to_U64(data)); 158 mNameValueReference.u64 = new U64(str_to_U64(ll_safe_string(data)));
159 } 159 }
160 else if (!strcmp(mStringType, "VEC3")) 160 else if (!strcmp(mStringType, "VEC3"))
161 { 161 {
diff --git a/linden/indra/llmessage/llpumpio.cpp b/linden/indra/llmessage/llpumpio.cpp
index f60ee2b..c92612f 100644
--- a/linden/indra/llmessage/llpumpio.cpp
+++ b/linden/indra/llmessage/llpumpio.cpp
@@ -36,7 +36,7 @@
36 36
37#include <map> 37#include <map>
38#include <set> 38#include <set>
39#include "apr-1/apr_poll.h" 39#include "apr_poll.h"
40 40
41#include "llapr.h" 41#include "llapr.h"
42#include "llmemtype.h" 42#include "llmemtype.h"
@@ -49,7 +49,7 @@
49//#define LL_DEBUG_PIPE_TYPE_IN_PUMP 1 49//#define LL_DEBUG_PIPE_TYPE_IN_PUMP 1
50//#define LL_DEBUG_POLL_FILE_DESCRIPTORS 1 50//#define LL_DEBUG_POLL_FILE_DESCRIPTORS 1
51#if LL_DEBUG_POLL_FILE_DESCRIPTORS 51#if LL_DEBUG_POLL_FILE_DESCRIPTORS
52#include "apr-1/apr_portable.h" 52#include "apr_portable.h"
53#endif 53#endif
54#endif 54#endif
55 55
@@ -261,7 +261,7 @@ bool LLPumpIO::addChain(
261bool LLPumpIO::setTimeoutSeconds(F32 timeout) 261bool LLPumpIO::setTimeoutSeconds(F32 timeout)
262{ 262{
263 // If no chain is running, return failure. 263 // If no chain is running, return failure.
264 if(current_chain_t() == mCurrentChain) 264 if(mRunningChains.end() == mCurrentChain)
265 { 265 {
266 return false; 266 return false;
267 } 267 }
@@ -365,7 +365,7 @@ S32 LLPumpIO::setLock()
365 // lock the runner at the same time. 365 // lock the runner at the same time.
366 366
367 // If no chain is running, return failure. 367 // If no chain is running, return failure.
368 if(current_chain_t() == mCurrentChain) 368 if(mRunningChains.end() == mCurrentChain)
369 { 369 {
370 return 0; 370 return 0;
371 } 371 }
@@ -414,7 +414,7 @@ bool LLPumpIO::sleepChain(F64 seconds)
414bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const 414bool LLPumpIO::copyCurrentLinkInfo(links_t& links) const
415{ 415{
416 LLMemType m1(LLMemType::MTYPE_IO_PUMP); 416 LLMemType m1(LLMemType::MTYPE_IO_PUMP);
417 if(current_chain_t() == mCurrentChain) 417 if(mRunningChains.end() == mCurrentChain)
418 { 418 {
419 return false; 419 return false;
420 } 420 }
@@ -584,6 +584,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
584 } 584 }
585 PUMP_DEBUG; 585 PUMP_DEBUG;
586 mCurrentChain = run_chain; 586 mCurrentChain = run_chain;
587
587 if((*run_chain).mDescriptors.empty()) 588 if((*run_chain).mDescriptors.empty())
588 { 589 {
589 // if there are no conditionals, just process this chain. 590 // if there are no conditionals, just process this chain.
@@ -702,7 +703,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
702 703
703 PUMP_DEBUG; 704 PUMP_DEBUG;
704 // null out the chain 705 // null out the chain
705 mCurrentChain = current_chain_t(); 706 mCurrentChain = mRunningChains.end();
706 END_PUMP_DEBUG; 707 END_PUMP_DEBUG;
707} 708}
708 709
diff --git a/linden/indra/llmessage/llpumpio.h b/linden/indra/llmessage/llpumpio.h
index 68db329..d2392a3 100644
--- a/linden/indra/llmessage/llpumpio.h
+++ b/linden/indra/llmessage/llpumpio.h
@@ -39,7 +39,7 @@
39#include <sys/param.h> 39#include <sys/param.h>
40#endif 40#endif
41 41
42#include "apr-1/apr_pools.h" 42#include "apr_pools.h"
43#include "llbuffer.h" 43#include "llbuffer.h"
44#include "llframetimer.h" 44#include "llframetimer.h"
45#include "lliopipe.h" 45#include "lliopipe.h"
diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h
index 1675478..af010ae 100644
--- a/linden/indra/llmessage/llregionflags.h
+++ b/linden/indra/llmessage/llregionflags.h
@@ -94,8 +94,8 @@ const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27);
94const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28); 94const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
95 95
96const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); 96const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
97const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); 97const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30);
98 98const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31);
99 99
100const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | 100const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
101 REGION_FLAGS_ALLOW_SET_HOME | 101 REGION_FLAGS_ALLOW_SET_HOME |
diff --git a/linden/indra/llmessage/llsdmessagereader.cpp b/linden/indra/llmessage/llsdmessagereader.cpp
index 70cc455..1f0effa 100755
--- a/linden/indra/llmessage/llsdmessagereader.cpp
+++ b/linden/indra/llmessage/llsdmessagereader.cpp
@@ -37,7 +37,15 @@
37#include "llsdmessagebuilder.h" 37#include "llsdmessagebuilder.h"
38#include "llsdutil.h" 38#include "llsdutil.h"
39 39
40LLSDMessageReader::LLSDMessageReader() 40#include "v3math.h"
41#include "v4math.h"
42#include "v3dmath.h"
43#include "v2math.h"
44#include "llquaternion.h"
45#include "v4color.h"
46
47LLSDMessageReader::LLSDMessageReader() :
48 mMessageName(NULL)
41{ 49{
42} 50}
43 51
@@ -63,14 +71,20 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum
63 } 71 }
64 if(! input[block].isArray()) 72 if(! input[block].isArray())
65 { 73 {
66 llerrs << "block " << block << " not found" << llendl; 74 // NOTE: babbage: need to return default for missing blocks to allow
75 // backwards/forwards compatibility - handlers must cope with default
76 // values.
77 llwarns << "block " << block << " not found" << llendl;
67 return LLSD(); 78 return LLSD();
68 } 79 }
69 80
70 LLSD result = input[block][blocknum][var]; 81 LLSD result = input[block][blocknum][var];
71 if(result.isUndefined()) 82 if(result.isUndefined())
72 { 83 {
73 llerrs << "var " << var << " not found" << llendl; 84 // NOTE: babbage: need to return default for missing vars to allow
85 // backwards/forwards compatibility - handlers must cope with default
86 // values.
87 llwarns << "var " << var << " not found" << llendl;
74 } 88 }
75 return result; 89 return result;
76} 90}
@@ -235,6 +249,12 @@ void LLSDMessageReader::getString(const char *block, const char *var,
235 buffer[data_size] = '\0'; 249 buffer[data_size] = '\0';
236} 250}
237 251
252//virtual
253void LLSDMessageReader::getString(const char *block, const char *var,
254 std::string& outstr, S32 blocknum)
255{
256 outstr = getLLSD(mMessage, block, var, blocknum).asString();
257}
238 258
239//virtual 259//virtual
240S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) 260S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname)
diff --git a/linden/indra/llmessage/llsdmessagereader.h b/linden/indra/llmessage/llsdmessagereader.h
index 698f751..9afa4a2 100755
--- a/linden/indra/llmessage/llsdmessagereader.h
+++ b/linden/indra/llmessage/llsdmessagereader.h
@@ -87,6 +87,8 @@ public:
87 S32 blocknum = 0); 87 S32 blocknum = 0);
88 virtual void getString(const char *block, const char *var, 88 virtual void getString(const char *block, const char *var,
89 S32 buffer_size, char *buffer, S32 blocknum = 0); 89 S32 buffer_size, char *buffer, S32 blocknum = 0);
90 virtual void getString(const char *block, const char *var, std::string& outstr,
91 S32 blocknum = 0);
90 92
91 virtual S32 getNumberOfBlocks(const char *blockname); 93 virtual S32 getNumberOfBlocks(const char *blockname);
92 virtual S32 getSize(const char *blockname, const char *varname); 94 virtual S32 getSize(const char *blockname, const char *varname);
diff --git a/linden/indra/llmessage/llservicebuilder.cpp b/linden/indra/llmessage/llservicebuilder.cpp
index 138ab2d..96f49ab 100644
--- a/linden/indra/llmessage/llservicebuilder.cpp
+++ b/linden/indra/llmessage/llservicebuilder.cpp
@@ -39,7 +39,7 @@
39void LLServiceBuilder::loadServiceDefinitionsFromFile( 39void LLServiceBuilder::loadServiceDefinitionsFromFile(
40 const std::string& service_filename) 40 const std::string& service_filename)
41{ 41{
42 llifstream service_file(service_filename.c_str(), std::ios::binary); 42 llifstream service_file(service_filename, std::ios::binary);
43 if(service_file.is_open()) 43 if(service_file.is_open())
44 { 44 {
45 LLSD service_data; 45 LLSD service_data;
@@ -111,10 +111,13 @@ std::string LLServiceBuilder::buildServiceURI(
111 const std::string& service_name, 111 const std::string& service_name,
112 const LLSD& option_map) 112 const LLSD& option_map)
113{ 113{
114 std::string service_url = buildServiceURI(service_name); 114 return russ_format(buildServiceURI(service_name), option_map);
115 115}
116 // Find the Service Name 116
117 if(!service_url.empty() && option_map.isMap()) 117std::string russ_format(const std::string& format_str, const LLSD& context)
118{
119 std::string service_url(format_str);
120 if(!service_url.empty() && context.isMap())
118 { 121 {
119 // throw in a ridiculously large limiter to make sure we don't 122 // throw in a ridiculously large limiter to make sure we don't
120 // loop forever with bad input. 123 // loop forever with bad input.
@@ -134,9 +137,9 @@ std::string LLServiceBuilder::buildServiceURI(
134 std::string::iterator end(service_url.end()); 137 std::string::iterator end(service_url.end());
135 std::string::iterator deepest_node(service_url.end()); 138 std::string::iterator deepest_node(service_url.end());
136 std::string::iterator deepest_node_end(service_url.end()); 139 std::string::iterator deepest_node_end(service_url.end());
137 //parse out the variables to replace by going through {}s one at a time, 140 // parse out the variables to replace by going through {}s
138 // starting with the "deepest" in series {{}}, 141 // one at a time, starting with the "deepest" in series
139 // and otherwise replacing right-to-left 142 // {{}}, and otherwise replacing right-to-left
140 for(; iter != end; ++iter) 143 for(; iter != end; ++iter)
141 { 144 {
142 switch(*iter) 145 switch(*iter)
@@ -171,7 +174,7 @@ std::string LLServiceBuilder::buildServiceURI(
171 // params and straight string substitution, so it's a 174 // params and straight string substitution, so it's a
172 // known distance of 2 to skip the directive. 175 // known distance of 2 to skip the directive.
173 std::string key(deepest_node + 2, deepest_node_end); 176 std::string key(deepest_node + 2, deepest_node_end);
174 LLSD value = option_map[key]; 177 LLSD value = context[key];
175 switch(*(deepest_node + 1)) 178 switch(*(deepest_node + 1))
176 { 179 {
177 case '$': 180 case '$':
@@ -184,7 +187,9 @@ std::string LLServiceBuilder::buildServiceURI(
184 } 187 }
185 else 188 else
186 { 189 {
187 llwarns << "Unknown key: " << key << " in option map: " << LLSDOStreamer<LLSDNotationFormatter>(option_map) << llendl; 190 llwarns << "Unknown key: " << key << " in option map: "
191 << LLSDOStreamer<LLSDNotationFormatter>(context)
192 << llendl;
188 keep_looping = false; 193 keep_looping = false;
189 } 194 }
190 break; 195 break;
@@ -212,50 +217,3 @@ std::string LLServiceBuilder::buildServiceURI(
212 } 217 }
213 return service_url; 218 return service_url;
214} 219}
215
216
217
218// Old, not as good implementation. Phoenix 2007-10-15
219#if 0
220 // Do brace replacements - NOT CURRENTLY RECURSIVE
221 for(LLSD::map_const_iterator option_itr = option_map.beginMap();
222 option_itr != option_map.endMap();
223 ++option_itr)
224 {
225 std::string variable_name = "{$";
226 variable_name.append((*option_itr).first);
227 variable_name.append("}");
228 std::string::size_type find_pos = service_url.find(variable_name);
229 if(find_pos != std::string::npos)
230 {
231 service_url.replace(
232 find_pos,
233 variable_name.length(),
234 (*option_itr).second.asString());
235 continue;
236 }
237 variable_name.assign("{%");
238 variable_name.append((*option_itr).first);
239 variable_name.append("}");
240 find_pos = service_url.find(variable_name);
241 if(find_pos != std::string::npos)
242 {
243 std::string query_str = LLURI::mapToQueryString(
244 (*option_itr).second);
245 service_url.replace(
246 find_pos,
247 variable_name.length(),
248 query_str);
249 }
250 }
251 }
252
253 if (service_url.find('{') != std::string::npos)
254 {
255 llwarns << "Constructed a likely bogus service URL: " << service_url
256 << llendl;
257 }
258
259 return service_url;
260}
261#endif
diff --git a/linden/indra/llmessage/llservicebuilder.h b/linden/indra/llmessage/llservicebuilder.h
index f19ba9a..ce95488 100644
--- a/linden/indra/llmessage/llservicebuilder.h
+++ b/linden/indra/llmessage/llservicebuilder.h
@@ -38,11 +38,24 @@
38 38
39class LLSD; 39class LLSD;
40 40
41/**
42 * @brief Format format string according to rules for RUSS.
43 *
44 * This function appears alongside the service builder since the
45 * algorithm was originally implemented there. This can eventually be
46 * moved when someone wants to take the time.
47 * @see https://osiris.lindenlab.com/mediawiki/index.php/Recursive_URL_Substitution_Syntax
48 * @param format_str The input string to format.
49 * @param context A map used for string substitutions.
50 * @return Returns the formatted string. If no match is found for a
51 * substitution target, the braces remain intact.
52 */
53std::string russ_format(const std::string& format_str, const LLSD& context);
54
41/** 55/**
42 * @class LLServiceBuilder 56 * @class LLServiceBuilder
43 * @brief This class builds urls for us to use when making web service calls. 57 * @brief This class builds urls for us to use when making web service calls.
44 */ 58 */
45
46class LLServiceBuilder 59class LLServiceBuilder
47{ 60{
48 LOG_CLASS(LLServiceBuilder); 61 LOG_CLASS(LLServiceBuilder);
diff --git a/linden/indra/llmessage/lltemplatemessagereader.cpp b/linden/indra/llmessage/lltemplatemessagereader.cpp
index 0d81383..f5da14b 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.cpp
+++ b/linden/indra/llmessage/lltemplatemessagereader.cpp
@@ -171,9 +171,6 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname)
171 171
172 if (iter == mCurrentRMessageData->mMemberBlocks.end()) 172 if (iter == mCurrentRMessageData->mMemberBlocks.end())
173 { 173 {
174// sprintf(errmsg, "Block %s not in message %s", bnamep, mCurrentRMessageData->mName);
175// llerrs << errmsg << llendl;
176// return -1;
177 return 0; 174 return 0;
178 } 175 }
179 176
@@ -433,6 +430,15 @@ inline void LLTemplateMessageReader::getString(const char *block, const char *va
433 s[buffer_size - 1] = '\0'; 430 s[buffer_size - 1] = '\0';
434} 431}
435 432
433inline void LLTemplateMessageReader::getString(const char *block, const char *var, std::string& outstr, S32 blocknum )
434{
435 char s[MTUBYTES];
436 s[0] = '\0';
437 getData(block, var, s, 0, blocknum, MTUBYTES);
438 s[MTUBYTES - 1] = '\0';
439 outstr = s;
440}
441
436//virtual 442//virtual
437S32 LLTemplateMessageReader::getMessageSize() const 443S32 LLTemplateMessageReader::getMessageSize() const
438{ 444{
@@ -568,7 +574,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender
568 // repeat number is a single byte 574 // repeat number is a single byte
569 if (decode_pos >= mReceiveSize) 575 if (decode_pos >= mReceiveSize)
570 { 576 {
571 logRanOffEndOfPacket(sender, decode_pos, 1); 577 // commented out - hetgrid says that missing variable blocks
578 // at end of message are legal
579 // logRanOffEndOfPacket(sender, decode_pos, 1);
572 580
573 // default to 0 repeats 581 // default to 0 repeats
574 repeat_number = 0; 582 repeat_number = 0;
diff --git a/linden/indra/llmessage/lltemplatemessagereader.h b/linden/indra/llmessage/lltemplatemessagereader.h
index 1448c2d..98f41ae 100644
--- a/linden/indra/llmessage/lltemplatemessagereader.h
+++ b/linden/indra/llmessage/lltemplatemessagereader.h
@@ -88,6 +88,8 @@ public:
88 S32 blocknum = 0); 88 S32 blocknum = 0);
89 virtual void getString(const char *block, const char *var, 89 virtual void getString(const char *block, const char *var,
90 S32 buffer_size, char *buffer, S32 blocknum = 0); 90 S32 buffer_size, char *buffer, S32 blocknum = 0);
91 virtual void getString(const char *block, const char *var, std::string& outstr,
92 S32 blocknum = 0);
91 93
92 virtual S32 getNumberOfBlocks(const char *blockname); 94 virtual S32 getNumberOfBlocks(const char *blockname);
93 virtual S32 getSize(const char *blockname, const char *varname); 95 virtual S32 getSize(const char *blockname, const char *varname);
diff --git a/linden/indra/llmessage/lltransfersourcefile.cpp b/linden/indra/llmessage/lltransfersourcefile.cpp
index 4b60cf3..a372f66 100644
--- a/linden/indra/llmessage/lltransfersourcefile.cpp
+++ b/linden/indra/llmessage/lltransfersourcefile.cpp
@@ -67,7 +67,7 @@ void LLTransferSourceFile::initTransfer()
67 return; 67 return;
68 } 68 }
69 // Look for the file. 69 // Look for the file.
70 mFP = LLFile::fopen(mParams.getFilename().c_str(), "rb"); /* Flawfinder: ignore */ 70 mFP = LLFile::fopen(mParams.getFilename(), "rb"); /* Flawfinder: ignore */
71 if (!mFP) 71 if (!mFP)
72 { 72 {
73 sendTransferStatus(LLTS_ERROR); 73 sendTransferStatus(LLTS_ERROR);
@@ -134,9 +134,9 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status)
134 134
135 } 135 }
136 // Delete the file iff the filename begins with "TEMP" 136 // Delete the file iff the filename begins with "TEMP"
137 if (mParams.getDeleteOnCompletion() && memcmp(mParams.getFilename().c_str(), "TEMP", 4) == 0) 137 if (mParams.getDeleteOnCompletion() && mParams.getFilename().substr(0, 4) == "TEMP")
138 { 138 {
139 LLFile::remove(mParams.getFilename().c_str()); 139 LLFile::remove(mParams.getFilename());
140 } 140 }
141} 141}
142 142
@@ -162,7 +162,7 @@ LLTransferSourceParamsFile::LLTransferSourceParamsFile() :
162 162
163void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const 163void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const
164{ 164{
165 dp.packString(mFilename.c_str(), "Filename"); 165 dp.packString(mFilename, "Filename");
166 dp.packU8((U8)mDeleteOnCompletion, "Delete"); 166 dp.packU8((U8)mDeleteOnCompletion, "Delete");
167} 167}
168 168
diff --git a/linden/indra/llmessage/lltransfersourcefile.h b/linden/indra/llmessage/lltransfersourcefile.h
index 030f80e..3137e1c 100644
--- a/linden/indra/llmessage/lltransfersourcefile.h
+++ b/linden/indra/llmessage/lltransfersourcefile.h
@@ -42,7 +42,7 @@ public:
42 /*virtual*/ void packParams(LLDataPacker &dp) const; 42 /*virtual*/ void packParams(LLDataPacker &dp) const;
43 /*virtual*/ BOOL unpackParams(LLDataPacker &dp); 43 /*virtual*/ BOOL unpackParams(LLDataPacker &dp);
44 44
45 void setFilename(const LLString &filename) { mFilename = filename; } 45 void setFilename(const std::string &filename) { mFilename = filename; }
46 std::string getFilename() const { return mFilename; } 46 std::string getFilename() const { return mFilename; }
47 47
48 void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } 48 void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; }
diff --git a/linden/indra/llmessage/lltransfertargetfile.cpp b/linden/indra/llmessage/lltransfertargetfile.cpp
index f1f602d..2723cb7 100644
--- a/linden/indra/llmessage/lltransfertargetfile.cpp
+++ b/linden/indra/llmessage/lltransfertargetfile.cpp
@@ -80,7 +80,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c
80 80
81 if (!mFP) 81 if (!mFP)
82 { 82 {
83 mFP = LLFile::fopen(mParams.mFilename.c_str(), "wb"); /* Flawfinder: ignore */ 83 mFP = LLFile::fopen(mParams.mFilename, "wb"); /* Flawfinder: ignore */
84 84
85 if (!mFP) 85 if (!mFP)
86 { 86 {
@@ -122,7 +122,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status)
122 if (mFP) 122 if (mFP)
123 { 123 {
124 // Only need to remove file if we successfully opened it. 124 // Only need to remove file if we successfully opened it.
125 LLFile::remove(mParams.mFilename.c_str()); 125 LLFile::remove(mParams.mFilename);
126 } 126 }
127 default: 127 default:
128 break; 128 break;
diff --git a/linden/indra/llmessage/lltransfertargetfile.h b/linden/indra/llmessage/lltransfertargetfile.h
index 02c0c11..4d92ec1 100644
--- a/linden/indra/llmessage/lltransfertargetfile.h
+++ b/linden/indra/llmessage/lltransfertargetfile.h
@@ -40,12 +40,12 @@ class LLTransferTargetParamsFile : public LLTransferTargetParams
40{ 40{
41public: 41public:
42 LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {} 42 LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {}
43 void setFilename(const LLString& filename) { mFilename = filename; } 43 void setFilename(const std::string& filename) { mFilename = filename; }
44 void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; } 44 void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; }
45 45
46 friend class LLTransferTargetFile; 46 friend class LLTransferTargetFile;
47protected: 47protected:
48 LLString mFilename; 48 std::string mFilename;
49 LLTTFCompleteCallback mCompleteCallback; 49 LLTTFCompleteCallback mCompleteCallback;
50 void * mUserData; 50 void * mUserData;
51}; 51};
diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp
index 5760197..42f3f04 100644
--- a/linden/indra/llmessage/llurlrequest.cpp
+++ b/linden/indra/llmessage/llurlrequest.cpp
@@ -42,7 +42,7 @@
42#include "llpumpio.h" 42#include "llpumpio.h"
43#include "llsd.h" 43#include "llsd.h"
44#include "llstring.h" 44#include "llstring.h"
45#include "apr-1/apr_env.h" 45#include "apr_env.h"
46 46
47static const U32 HTTP_STATUS_PIPE_ERROR = 499; 47static const U32 HTTP_STATUS_PIPE_ERROR = 499;
48 48
@@ -385,6 +385,13 @@ bool LLURLRequest::configure()
385 rv = true; 385 rv = true;
386 break; 386 break;
387 387
388 case HTTP_MOVE:
389 // Set the handle for an http post
390 mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE");
391 // *NOTE: should we check for the Destination header?
392 rv = true;
393 break;
394
388 default: 395 default:
389 llwarns << "Unhandled URLRequest action: " << mAction << llendl; 396 llwarns << "Unhandled URLRequest action: " << mAction << llendl;
390 break; 397 break;
@@ -535,7 +542,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl(
535 // find the context url 542 // find the context url
536 if(context.has(CONTEXT_DEST_URI_SD_LABEL)) 543 if(context.has(CONTEXT_DEST_URI_SD_LABEL))
537 { 544 {
538 mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL]); 545 mRequest->setURL(context[CONTEXT_DEST_URI_SD_LABEL].asString());
539 return STATUS_DONE; 546 return STATUS_DONE;
540 } 547 }
541 return STATUS_ERROR; 548 return STATUS_ERROR;
diff --git a/linden/indra/llmessage/llurlrequest.h b/linden/indra/llmessage/llurlrequest.h
index b6da56b..888b962 100644
--- a/linden/indra/llmessage/llurlrequest.h
+++ b/linden/indra/llmessage/llurlrequest.h
@@ -76,6 +76,7 @@ public:
76 HTTP_PUT, 76 HTTP_PUT,
77 HTTP_POST, 77 HTTP_POST,
78 HTTP_DELETE, 78 HTTP_DELETE,
79 HTTP_MOVE, // Caller will need to set 'Destination' header
79 REQUEST_ACTION_COUNT 80 REQUEST_ACTION_COUNT
80 }; 81 };
81 82
diff --git a/linden/indra/llmessage/llxfer.cpp b/linden/indra/llmessage/llxfer.cpp
index 5430213..ab7b1ee 100644
--- a/linden/indra/llmessage/llxfer.cpp
+++ b/linden/indra/llmessage/llxfer.cpp
@@ -103,7 +103,7 @@ void LLXfer::free ()
103 103
104S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host) 104S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host)
105{ 105{
106 llwarns << "undifferentiated LLXfer::startSend for " << getName() << llendl; 106 llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl;
107 return (-1); 107 return (-1);
108} 108}
109 109
@@ -119,7 +119,7 @@ void LLXfer::setXferSize (S32 xfer_size)
119 119
120S32 LLXfer::startDownload() 120S32 LLXfer::startDownload()
121{ 121{
122 llwarns << "undifferentiated LLXfer::startDownload for " << getName() 122 llwarns << "undifferentiated LLXfer::startDownload for " << getFileName()
123 << llendl; 123 << llendl;
124 return (-1); 124 return (-1);
125} 125}
@@ -293,13 +293,13 @@ S32 LLXfer::processEOF()
293 293
294 if (LL_ERR_NOERR == mCallbackResult) 294 if (LL_ERR_NOERR == mCallbackResult)
295 { 295 {
296 llinfos << "xfer from " << mRemoteHost << " complete: " << getName() 296 llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName()
297 << llendl; 297 << llendl;
298 } 298 }
299 else 299 else
300 { 300 {
301 llinfos << "xfer from " << mRemoteHost << " failed, code " 301 llinfos << "xfer from " << mRemoteHost << " failed, code "
302 << mCallbackResult << ": " << getName() << llendl; 302 << mCallbackResult << ": " << getFileName() << llendl;
303 } 303 }
304 304
305 if (mCallback) 305 if (mCallback)
@@ -327,7 +327,7 @@ void LLXfer::abort (S32 result_code)
327{ 327{
328 mCallbackResult = result_code; 328 mCallbackResult = result_code;
329 329
330 llinfos << "Aborting xfer from " << mRemoteHost << " named " << getName() 330 llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName()
331 << " - error: " << result_code << llendl; 331 << " - error: " << result_code << llendl;
332 332
333 gMessageSystem->newMessageFast(_PREHASH_AbortXfer); 333 gMessageSystem->newMessageFast(_PREHASH_AbortXfer);
@@ -343,11 +343,9 @@ void LLXfer::abort (S32 result_code)
343 343
344/////////////////////////////////////////////////////////// 344///////////////////////////////////////////////////////////
345 345
346const char * LLXfer::getName() 346std::string LLXfer::getFileName()
347{ 347{
348 static char tmp_str[256]; /* Flawfinder: ignore */ 348 return U64_to_str(mID);
349
350 return (U64_to_str(mID, tmp_str, sizeof(tmp_str)));
351} 349}
352 350
353/////////////////////////////////////////////////////////// 351///////////////////////////////////////////////////////////
@@ -367,7 +365,7 @@ S32 LLXfer::getMaxBufferSize ()
367 365
368std::ostream& operator<< (std::ostream& os, LLXfer &hh) 366std::ostream& operator<< (std::ostream& os, LLXfer &hh)
369{ 367{
370 os << hh.getName() ; 368 os << hh.getFileName() ;
371 return os; 369 return os;
372} 370}
373 371
diff --git a/linden/indra/llmessage/llxfer.h b/linden/indra/llmessage/llxfer.h
index 603b4d7..259f1ac 100644
--- a/linden/indra/llmessage/llxfer.h
+++ b/linden/indra/llmessage/llxfer.h
@@ -106,7 +106,7 @@ class LLXfer
106 virtual void setXferSize (S32 data_size); 106 virtual void setXferSize (S32 data_size);
107 virtual S32 getMaxBufferSize(); 107 virtual S32 getMaxBufferSize();
108 108
109 virtual const char *getName(); 109 virtual std::string getFileName();
110 110
111 virtual U32 getXferTypeTag(); 111 virtual U32 getXferTypeTag();
112 112
diff --git a/linden/indra/llmessage/llxfer_file.cpp b/linden/indra/llmessage/llxfer_file.cpp
index 840d84c..da12d54 100644
--- a/linden/indra/llmessage/llxfer_file.cpp
+++ b/linden/indra/llmessage/llxfer_file.cpp
@@ -47,17 +47,17 @@
47const U32 LL_MAX_XFER_FILE_BUFFER = 65536; 47const U32 LL_MAX_XFER_FILE_BUFFER = 65536;
48 48
49// local function to copy a file 49// local function to copy a file
50S32 copy_file(const char* from, const char* to); 50S32 copy_file(const std::string& from, const std::string& to);
51 51
52/////////////////////////////////////////////////////////// 52///////////////////////////////////////////////////////////
53 53
54LLXfer_File::LLXfer_File (S32 chunk_size) 54LLXfer_File::LLXfer_File (S32 chunk_size)
55: LLXfer(chunk_size) 55: LLXfer(chunk_size)
56{ 56{
57 init(LLString::null, FALSE, chunk_size); 57 init(LLStringUtil::null, FALSE, chunk_size);
58} 58}
59 59
60LLXfer_File::LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) 60LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size)
61: LLXfer(chunk_size) 61: LLXfer(chunk_size)
62{ 62{
63 init(local_filename, delete_local_on_completion, chunk_size); 63 init(local_filename, delete_local_on_completion, chunk_size);
@@ -72,24 +72,24 @@ LLXfer_File::~LLXfer_File ()
72 72
73/////////////////////////////////////////////////////////// 73///////////////////////////////////////////////////////////
74 74
75void LLXfer_File::init (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size) 75void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size)
76{ 76{
77 77
78 mFp = NULL; 78 mFp = NULL;
79 mLocalFilename[0] = 0; 79 mLocalFilename.clear();
80 mRemoteFilename[0] = 0; 80 mRemoteFilename.clear();
81 mRemotePath = LL_PATH_NONE; 81 mRemotePath = LL_PATH_NONE;
82 mTempFilename[0] = 0; 82 mTempFilename.clear();
83 mDeleteLocalOnCompletion = FALSE; 83 mDeleteLocalOnCompletion = FALSE;
84 mDeleteRemoteOnCompletion = FALSE; 84 mDeleteRemoteOnCompletion = FALSE;
85 85
86 if (!local_filename.empty()) 86 if (!local_filename.empty())
87 { 87 {
88 strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); 88 mLocalFilename = local_filename.substr(0,LL_MAX_PATH-1);
89 mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
90 89
91 // You can only automatically delete .tmp file as a safeguard against nasty messages. 90 // You can only automatically delete .tmp file as a safeguard against nasty messages.
92 mDeleteLocalOnCompletion = (delete_local_on_completion && (strstr(mLocalFilename,".tmp") == &mLocalFilename[strlen(mLocalFilename)-4])); /* Flawfinder : ignore */ 91 std::string exten = mLocalFilename.substr(mLocalFilename.length()-4, 4);
92 mDeleteLocalOnCompletion = (delete_local_on_completion && exten == ".tmp");
93 } 93 }
94} 94}
95 95
@@ -121,8 +121,8 @@ void LLXfer_File::free ()
121/////////////////////////////////////////////////////////// 121///////////////////////////////////////////////////////////
122 122
123S32 LLXfer_File::initializeRequest(U64 xfer_id, 123S32 LLXfer_File::initializeRequest(U64 xfer_id,
124 const LLString& local_filename, 124 const std::string& local_filename,
125 const LLString& remote_filename, 125 const std::string& remote_filename,
126 ELLPath remote_path, 126 ELLPath remote_path,
127 const LLHost& remote_host, 127 const LLHost& remote_host,
128 BOOL delete_remote_on_completion, 128 BOOL delete_remote_on_completion,
@@ -132,15 +132,13 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id,
132 S32 retval = 0; // presume success 132 S32 retval = 0; // presume success
133 133
134 mID = xfer_id; 134 mID = xfer_id;
135 strncpy(mLocalFilename, local_filename.c_str(), LL_MAX_PATH-1); 135 mLocalFilename = local_filename;
136 mLocalFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy. 136 mRemoteFilename = remote_filename;
137 strncpy(mRemoteFilename,remote_filename.c_str(), LL_MAX_PATH-1);
138 mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
139 mRemotePath = remote_path; 137 mRemotePath = remote_path;
140 mRemoteHost = remote_host; 138 mRemoteHost = remote_host;
141 mDeleteRemoteOnCompletion = delete_remote_on_completion; 139 mDeleteRemoteOnCompletion = delete_remote_on_completion;
142 140
143 snprintf(mTempFilename, sizeof(mTempFilename), "%s",gDirUtilp->getTempFilename().c_str()); /* Flawfinder: ignore */ 141 mTempFilename = gDirUtilp->getTempFilename();
144 142
145 mCallback = callback; 143 mCallback = callback;
146 mCallbackDataHandle = user_data; 144 mCallbackDataHandle = user_data;
@@ -343,7 +341,7 @@ S32 LLXfer_File::processEOF()
343 if(copy_file(mTempFilename, mLocalFilename) == 0) 341 if(copy_file(mTempFilename, mLocalFilename) == 0)
344 { 342 {
345 llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl; 343 llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl;
346 unlink(mTempFilename); 344 unlink(mTempFilename.c_str());
347 } 345 }
348 else 346 else
349 { 347 {
@@ -384,14 +382,14 @@ S32 LLXfer_File::processEOF()
384 382
385/////////////////////////////////////////////////////////// 383///////////////////////////////////////////////////////////
386 384
387BOOL LLXfer_File::matchesLocalFilename(const LLString& filename) 385BOOL LLXfer_File::matchesLocalFilename(const std::string& filename)
388{ 386{
389 return (filename == mLocalFilename); 387 return (filename == mLocalFilename);
390} 388}
391 389
392/////////////////////////////////////////////////////////// 390///////////////////////////////////////////////////////////
393 391
394BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote_path) 392BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path)
395{ 393{
396 return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); 394 return ((filename == mRemoteFilename) && (remote_path == mRemotePath));
397} 395}
@@ -399,9 +397,9 @@ BOOL LLXfer_File::matchesRemoteFilename(const LLString& filename, ELLPath remote
399 397
400/////////////////////////////////////////////////////////// 398///////////////////////////////////////////////////////////
401 399
402const char * LLXfer_File::getName() 400std::string LLXfer_File::getFileName()
403{ 401{
404 return (mLocalFilename); 402 return mLocalFilename;
405} 403}
406 404
407/////////////////////////////////////////////////////////// 405///////////////////////////////////////////////////////////
@@ -421,7 +419,7 @@ U32 LLXfer_File::getXferTypeTag()
421// function. It does not really spam enough information, but is useful 419// function. It does not really spam enough information, but is useful
422// for this cpp file, because this should never be called in a 420// for this cpp file, because this should never be called in a
423// production environment. 421// production environment.
424S32 copy_file(const char* from, const char* to) 422S32 copy_file(const std::string& from, const std::string& to)
425{ 423{
426 S32 rv = 0; 424 S32 rv = 0;
427 LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ 425 LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/
diff --git a/linden/indra/llmessage/llxfer_file.h b/linden/indra/llmessage/llxfer_file.h
index b5294ad..78f77a8 100644
--- a/linden/indra/llmessage/llxfer_file.h
+++ b/linden/indra/llmessage/llxfer_file.h
@@ -39,25 +39,25 @@ class LLXfer_File : public LLXfer
39{ 39{
40 protected: 40 protected:
41 LLFILE *mFp; 41 LLFILE *mFp;
42 char mLocalFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ 42 std::string mLocalFilename;
43 char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ 43 std::string mRemoteFilename;
44 ELLPath mRemotePath; 44 ELLPath mRemotePath;
45 char mTempFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ 45 std::string mTempFilename;
46 46
47 BOOL mDeleteLocalOnCompletion; 47 BOOL mDeleteLocalOnCompletion;
48 BOOL mDeleteRemoteOnCompletion; 48 BOOL mDeleteRemoteOnCompletion;
49 49
50 public: 50 public:
51 LLXfer_File (S32 chunk_size); 51 LLXfer_File (S32 chunk_size);
52 LLXfer_File (const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); 52 LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size);
53 virtual ~LLXfer_File(); 53 virtual ~LLXfer_File();
54 54
55 virtual void init(const LLString& local_filename, BOOL delete_local_on_completion, S32 chunk_size); 55 virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size);
56 virtual void free(); 56 virtual void free();
57 57
58 virtual S32 initializeRequest(U64 xfer_id, 58 virtual S32 initializeRequest(U64 xfer_id,
59 const LLString& local_filename, 59 const std::string& local_filename,
60 const LLString& remote_filename, 60 const std::string& remote_filename,
61 ELLPath remote_path, 61 ELLPath remote_path,
62 const LLHost& remote_host, 62 const LLHost& remote_host,
63 BOOL delete_remote_on_completion, 63 BOOL delete_remote_on_completion,
@@ -72,14 +72,14 @@ class LLXfer_File : public LLXfer
72 virtual S32 suck(S32 start_position); 72 virtual S32 suck(S32 start_position);
73 virtual S32 flush(); 73 virtual S32 flush();
74 74
75 virtual BOOL matchesLocalFilename(const LLString& filename); 75 virtual BOOL matchesLocalFilename(const std::string& filename);
76 virtual BOOL matchesRemoteFilename(const LLString& filename, ELLPath remote_path); 76 virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path);
77 77
78 virtual S32 getMaxBufferSize(); 78 virtual S32 getMaxBufferSize();
79 79
80 virtual U32 getXferTypeTag(); 80 virtual U32 getXferTypeTag();
81 81
82 virtual const char *getName(); 82 virtual std::string getFileName();
83}; 83};
84 84
85#endif 85#endif
diff --git a/linden/indra/llmessage/llxfer_mem.cpp b/linden/indra/llmessage/llxfer_mem.cpp
index 614f027..3404520 100644
--- a/linden/indra/llmessage/llxfer_mem.cpp
+++ b/linden/indra/llmessage/llxfer_mem.cpp
@@ -55,7 +55,7 @@ LLXfer_Mem::~LLXfer_Mem ()
55 55
56void LLXfer_Mem::init () 56void LLXfer_Mem::init ()
57{ 57{
58 mRemoteFilename[0] = '\0'; 58 mRemoteFilename.clear();
59 mRemotePath = LL_PATH_NONE; 59 mRemotePath = LL_PATH_NONE;
60 mDeleteRemoteOnCompletion = FALSE; 60 mDeleteRemoteOnCompletion = FALSE;
61} 61}
@@ -120,7 +120,7 @@ S32 LLXfer_Mem::startSend (U64 xfer_id, const LLHost &remote_host)
120 mID = xfer_id; 120 mID = xfer_id;
121 mPacketNum = -1; 121 mPacketNum = -1;
122 122
123// cout << "Sending file: " << getName() << endl; 123// cout << "Sending file: " << getFileName() << endl;
124 124
125 mStatus = e_LL_XFER_PENDING; 125 mStatus = e_LL_XFER_PENDING;
126 126
@@ -135,7 +135,7 @@ S32 LLXfer_Mem::processEOF()
135 135
136 mStatus = e_LL_XFER_COMPLETE; 136 mStatus = e_LL_XFER_COMPLETE;
137 137
138 llinfos << "xfer complete: " << getName() << llendl; 138 llinfos << "xfer complete: " << getFileName() << llendl;
139 139
140 if (mCallback) 140 if (mCallback)
141 { 141 {
@@ -165,8 +165,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id,
165 mCallbackDataHandle = user_data; 165 mCallbackDataHandle = user_data;
166 mCallbackResult = LL_ERR_NOERR; 166 mCallbackResult = LL_ERR_NOERR;
167 167
168 strncpy(mRemoteFilename, remote_filename.c_str(), LL_MAX_PATH-1); 168 mRemoteFilename = remote_filename;
169 mRemoteFilename[LL_MAX_PATH-1] = '\0'; // stupid strncpy.
170 mRemotePath = remote_path; 169 mRemotePath = remote_path;
171 mDeleteRemoteOnCompletion = delete_remote_on_completion; 170 mDeleteRemoteOnCompletion = delete_remote_on_completion;
172 171
diff --git a/linden/indra/llmessage/llxfer_mem.h b/linden/indra/llmessage/llxfer_mem.h
index a3d6ca5..0e67a06 100644
--- a/linden/indra/llmessage/llxfer_mem.h
+++ b/linden/indra/llmessage/llxfer_mem.h
@@ -42,7 +42,7 @@ class LLXfer_Mem : public LLXfer
42 private: 42 private:
43 protected: 43 protected:
44 void (*mCallback)(void *, S32, void **, S32, LLExtStat); 44 void (*mCallback)(void *, S32, void **, S32, LLExtStat);
45 char mRemoteFilename[LL_MAX_PATH]; /* Flawfinder : ignore */ 45 std::string mRemoteFilename;
46 ELLPath mRemotePath; 46 ELLPath mRemotePath;
47 BOOL mDeleteRemoteOnCompletion; 47 BOOL mDeleteRemoteOnCompletion;
48 48
diff --git a/linden/indra/llmessage/llxfer_vfile.cpp b/linden/indra/llmessage/llxfer_vfile.cpp
index 69d580a..aede763 100644
--- a/linden/indra/llmessage/llxfer_vfile.cpp
+++ b/linden/indra/llmessage/llxfer_vfile.cpp
@@ -74,10 +74,10 @@ void LLXfer_VFile::init (LLVFS *vfs, const LLUUID &local_id, LLAssetType::EType
74 74
75 mVFile = NULL; 75 mVFile = NULL;
76 76
77 char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ 77 std::string id_string;
78 mLocalID.toString(id_string); 78 mLocalID.toString(id_string);
79 79
80 snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ 80 mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType));
81} 81}
82 82
83/////////////////////////////////////////////////////////// 83///////////////////////////////////////////////////////////
@@ -118,10 +118,10 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id,
118 mCallbackDataHandle = user_data; 118 mCallbackDataHandle = user_data;
119 mCallbackResult = LL_ERR_NOERR; 119 mCallbackResult = LL_ERR_NOERR;
120 120
121 char id_string[UUID_STR_LENGTH]; /* Flawfinder : ignore */ 121 std::string id_string;
122 mLocalID.toString(id_string); 122 mLocalID.toString(id_string);
123 123
124 snprintf(mName, sizeof(mName), "VFile %s:%s", id_string, LLAssetType::lookup(mType)); /* Flawfinder : ignore */ 124 mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType));
125 125
126 llinfos << "Requesting " << mName << llendl; 126 llinfos << "Requesting " << mName << llendl;
127 127
@@ -328,7 +328,7 @@ BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type)
328 328
329////////////////////////////////////////////////////////// 329//////////////////////////////////////////////////////////
330 330
331const char * LLXfer_VFile::getName() 331std::string LLXfer_VFile::getFileName()
332{ 332{
333 return mName; 333 return mName;
334} 334}
diff --git a/linden/indra/llmessage/llxfer_vfile.h b/linden/indra/llmessage/llxfer_vfile.h
index 8c0bebb..12d38ba 100644
--- a/linden/indra/llmessage/llxfer_vfile.h
+++ b/linden/indra/llmessage/llxfer_vfile.h
@@ -50,7 +50,7 @@ class LLXfer_VFile : public LLXfer
50 50
51 LLVFS *mVFS; 51 LLVFS *mVFS;
52 52
53 char mName[MAX_STRING]; /* Flawfinder : ignore */ 53 std::string mName;
54 54
55 public: 55 public:
56 LLXfer_VFile (); 56 LLXfer_VFile ();
@@ -85,7 +85,7 @@ class LLXfer_VFile : public LLXfer
85 85
86 virtual U32 getXferTypeTag(); 86 virtual U32 getXferTypeTag();
87 87
88 virtual const char *getName(); 88 virtual std::string getFileName();
89}; 89};
90 90
91#endif 91#endif
diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp
index 8bf9813..90188b6 100644
--- a/linden/indra/llmessage/llxfermanager.cpp
+++ b/linden/indra/llmessage/llxfermanager.cpp
@@ -406,8 +406,8 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length)
406 406
407/////////////////////////////////////////////////////////// 407///////////////////////////////////////////////////////////
408 408
409void LLXferManager::requestFile(const char* local_filename, 409void LLXferManager::requestFile(const std::string& local_filename,
410 const char* remote_filename, 410 const std::string& remote_filename,
411 ELLPath remote_path, 411 ELLPath remote_path,
412 const LLHost& remote_host, 412 const LLHost& remote_host,
413 BOOL delete_remote_on_completion, 413 BOOL delete_remote_on_completion,
@@ -444,7 +444,7 @@ void LLXferManager::requestFile(const char* local_filename,
444 // Note: according to AaronB, this is here to deal with locks on files that were 444 // Note: according to AaronB, this is here to deal with locks on files that were
445 // in transit during a crash, 445 // in transit during a crash,
446 if(delete_remote_on_completion && 446 if(delete_remote_on_completion &&
447 (strstr(remote_filename,".tmp") == &remote_filename[strlen(remote_filename)-4])) /* Flawfinder : ignore */ 447 (remote_filename.substr(remote_filename.length()-4) == ".tmp"))
448 { 448 {
449 LLFile::remove(local_filename); 449 LLFile::remove(local_filename);
450 } 450 }
@@ -464,7 +464,7 @@ void LLXferManager::requestFile(const char* local_filename,
464 } 464 }
465} 465}
466 466
467void LLXferManager::requestFile(const char* remote_filename, 467void LLXferManager::requestFile(const std::string& remote_filename,
468 ELLPath remote_path, 468 ELLPath remote_path,
469 const LLHost& remote_host, 469 const LLHost& remote_host,
470 BOOL delete_remote_on_completion, 470 BOOL delete_remote_on_completion,
@@ -540,7 +540,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id,
540 540
541/* 541/*
542void LLXferManager::requestXfer( 542void LLXferManager::requestXfer(
543 const char *local_filename, 543 const std::string& local_filename,
544 BOOL delete_remote_on_completion, 544 BOOL delete_remote_on_completion,
545 U64 xfer_id, 545 U64 xfer_id,
546 const LLHost &remote_host, 546 const LLHost &remote_host,
@@ -634,11 +634,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
634 // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped 634 // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped
635 if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1)) 635 if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1))
636 { 636 {
637 llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); 637 llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender());
638 } 638 }
639 else 639 else
640 { 640 {
641 llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; 641 llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl;
642 } 642 }
643 return; 643 return;
644 } 644 }
@@ -717,7 +717,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
717{ 717{
718 718
719 U64 id; 719 U64 id;
720 char local_filename[MAX_STRING]; /* Flawfinder : ignore */ 720 std::string local_filename;
721 ELLPath local_path = LL_PATH_NONE; 721 ELLPath local_path = LL_PATH_NONE;
722 S32 result = LL_ERR_NOERR; 722 S32 result = LL_ERR_NOERR;
723 LLUUID uuid; 723 LLUUID uuid;
@@ -732,7 +732,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
732 llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) 732 llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF))
733 << " to " << mesgsys->getSender() << llendl; 733 << " to " << mesgsys->getSender() << llendl;
734 734
735 mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, MAX_STRING, local_filename); 735 mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename);
736 736
737 U8 local_path_u8; 737 U8 local_path_u8;
738 mesgsys->getU8("XferID", "FilePath", local_path_u8); 738 mesgsys->getU8("XferID", "FilePath", local_path_u8);
@@ -780,7 +780,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
780 llerrs << "Xfer allcoation error" << llendl; 780 llerrs << "Xfer allcoation error" << llendl;
781 } 781 }
782 } 782 }
783 else if (strlen(local_filename)) /* Flawfinder : ignore */ 783 else if (!local_filename.empty())
784 { 784 {
785 std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename ); 785 std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename );
786 llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl; 786 llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl;
@@ -923,7 +923,7 @@ void LLXferManager::retransmitUnackedPackets ()
923 { 923 {
924 if (xferp->mRetries > LL_PACKET_RETRY_LIMIT) 924 if (xferp->mRetries > LL_PACKET_RETRY_LIMIT)
925 { 925 {
926 llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet retransmit limit exceeded, xfer dropped" << llendl; 926 llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl;
927 xferp->abort(LL_ERR_TCP_TIMEOUT); 927 xferp->abort(LL_ERR_TCP_TIMEOUT);
928 delp = xferp; 928 delp = xferp;
929 xferp = xferp->mNext; 929 xferp = xferp->mNext;
@@ -931,7 +931,7 @@ void LLXferManager::retransmitUnackedPackets ()
931 } 931 }
932 else 932 else
933 { 933 {
934 llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; 934 llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl;
935 xferp->resendLastPacket(); 935 xferp->resendLastPacket();
936 xferp = xferp->mNext; 936 xferp = xferp->mNext;
937 } 937 }
@@ -946,7 +946,7 @@ void LLXferManager::retransmitUnackedPackets ()
946 } 946 }
947 else if (xferp->mStatus == e_LL_XFER_ABORTED) 947 else if (xferp->mStatus == e_LL_XFER_ABORTED)
948 { 948 {
949 llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getName() << llendl; 949 llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl;
950 delp = xferp; 950 delp = xferp;
951 xferp = xferp->mNext; 951 xferp = xferp->mNext;
952 removeXfer(delp,&mSendList); 952 removeXfer(delp,&mSendList);
diff --git a/linden/indra/llmessage/llxfermanager.h b/linden/indra/llmessage/llxfermanager.h
index 82cd8e9..12b3ec0 100644
--- a/linden/indra/llmessage/llxfermanager.h
+++ b/linden/indra/llmessage/llxfermanager.h
@@ -143,8 +143,8 @@ class LLXferManager
143 143
144// file requesting routines 144// file requesting routines
145// .. to file 145// .. to file
146 virtual void requestFile(const char* local_filename, 146 virtual void requestFile(const std::string& local_filename,
147 const char* remote_filename, 147 const std::string& remote_filename,
148 ELLPath remote_path, 148 ELLPath remote_path,
149 const LLHost& remote_host, 149 const LLHost& remote_host,
150 BOOL delete_remote_on_completion, 150 BOOL delete_remote_on_completion,
@@ -153,7 +153,7 @@ class LLXferManager
153 BOOL use_big_packets = FALSE); 153 BOOL use_big_packets = FALSE);
154 154
155// .. to memory 155// .. to memory
156 virtual void requestFile(const char* remote_filename, 156 virtual void requestFile(const std::string& remote_filename,
157 ELLPath remote_path, 157 ELLPath remote_path,
158 const LLHost &remote_host, 158 const LLHost &remote_host,
159 BOOL delete_remote_on_completion, 159 BOOL delete_remote_on_completion,
diff --git a/linden/indra/llmessage/mean_collision_data.h b/linden/indra/llmessage/mean_collision_data.h
index 1f245f9..0f09c3e 100644
--- a/linden/indra/llmessage/mean_collision_data.h
+++ b/linden/indra/llmessage/mean_collision_data.h
@@ -55,15 +55,13 @@ class LLMeanCollisionData
55public: 55public:
56 LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag) 56 LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag)
57 : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag) 57 : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag)
58 { mFirstName[0] = 0; mLastName[0] = 0; } 58 {
59 }
59 60
60 LLMeanCollisionData(LLMeanCollisionData *mcd) 61 LLMeanCollisionData(LLMeanCollisionData *mcd)
61 : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag) 62 : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag),
62 { 63 mFirstName(mcd->mFirstName), mLastName(mcd->mLastName)
63 strncpy(mFirstName, mcd->mFirstName, sizeof(mFirstName) -1); /* Flawfinder: Ignore */ 64 {
64 mFirstName[sizeof(mFirstName) -1] = '\0';
65 strncpy(mLastName, mcd->mLastName, sizeof(mLastName) -1); /* Flawfinder: Ignore */
66 mLastName[sizeof(mLastName) -1] = '\0';
67 } 65 }
68 66
69 friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a) 67 friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a)
@@ -96,8 +94,8 @@ public:
96 time_t mTime; 94 time_t mTime;
97 EMeanCollisionType mType; 95 EMeanCollisionType mType;
98 F32 mMag; 96 F32 mMag;
99 char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ 97 std::string mFirstName;
100 char mLastName[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: Ignore */ 98 std::string mLastName;
101}; 99};
102 100
103 101
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index f3aac29..27f9d12 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -46,9 +46,9 @@
46#include <sstream> 46#include <sstream>
47 47
48#include "llapr.h" 48#include "llapr.h"
49#include "apr-1/apr_portable.h" 49#include "apr_portable.h"
50#include "apr-1/apr_network_io.h" 50#include "apr_network_io.h"
51#include "apr-1/apr_poll.h" 51#include "apr_poll.h"
52 52
53// linden library headers 53// linden library headers
54#include "indra_constants.h" 54#include "indra_constants.h"
@@ -286,10 +286,11 @@ void LLMessageSystem::init()
286} 286}
287 287
288// Read file and build message templates 288// Read file and build message templates
289LLMessageSystem::LLMessageSystem(const char *filename, U32 port, 289LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
290 S32 version_major, 290 S32 version_major,
291 S32 version_minor, 291 S32 version_minor,
292 S32 version_patch) 292 S32 version_patch,
293 bool failure_is_fatal)
293{ 294{
294 init(); 295 init();
295 296
@@ -306,7 +307,7 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port,
306 307
307 mCircuitPrintFreq = 60.f; // seconds 308 mCircuitPrintFreq = 60.f; // seconds
308 309
309 loadTemplateFile(filename); 310 loadTemplateFile(filename, failure_is_fatal);
310 311
311 mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates); 312 mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates);
312 mLLSDMessageBuilder = new LLSDMessageBuilder(); 313 mLLSDMessageBuilder = new LLSDMessageBuilder();
@@ -365,9 +366,9 @@ LLMessageSystem::LLMessageSystem(const char *filename, U32 port,
365 366
366 367
367// Read file and build message templates 368// Read file and build message templates
368void LLMessageSystem::loadTemplateFile(const char* filename) 369void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure_is_fatal)
369{ 370{
370 if(!filename) 371 if(filename.empty())
371 { 372 {
372 LL_ERRS("Messaging") << "No template filename specified" << llendl; 373 LL_ERRS("Messaging") << "No template filename specified" << llendl;
373 mbError = TRUE; 374 mbError = TRUE;
@@ -377,7 +378,11 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
377 std::string template_body; 378 std::string template_body;
378 if(!_read_file_into_string(template_body, filename)) 379 if(!_read_file_into_string(template_body, filename))
379 { 380 {
380 LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; 381 if (failure_is_fatal) {
382 LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl;
383 } else {
384 LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl;
385 }
381 mbError = TRUE; 386 mbError = TRUE;
382 return; 387 return;
383 } 388 }
@@ -686,9 +691,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
686 { 691 {
687 std::ostringstream str; 692 std::ostringstream str;
688 str << "MSG: <- " << host; 693 str << "MSG: <- " << host;
689 char buffer[MAX_STRING]; /* Flawfinder: ignore*/ 694 std::string tbuf;
690 snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID); /* Flawfinder: ignore */ 695 tbuf = llformat( "\t%6d\t%6d\t%6d ", receive_size, (mIncomingCompressedSize ? mIncomingCompressedSize : receive_size), mCurrentRecvPacketID);
691 str << buffer << "(unknown)" 696 str << tbuf << "(unknown)"
692 << (recv_reliable ? " reliable" : "") 697 << (recv_reliable ? " reliable" : "")
693 << " resent " 698 << " resent "
694 << ((acks > 0) ? "acks" : "") 699 << ((acks > 0) ? "acks" : "")
@@ -816,10 +821,9 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
816 821
817 LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep]; 822 LLMsgBlkData *msg_block_data = mCurrentRMessageData->mMemberBlocks[bnamep];
818 823
819 char errmsg[1024];
820 if (!msg_block_data) 824 if (!msg_block_data)
821 { 825 {
822 sprintf(errmsg, "Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName); 826 std::string errmsg = llformat("Block %s #%d not in message %s", block_name, blocknum, mCurrentRMessageData->mName);
823 LL_ERRS("Messaging") << errmsg << llendl; 827 LL_ERRS("Messaging") << errmsg << llendl;
824 } 828 }
825 829
@@ -827,7 +831,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
827 831
828 if (!vardata.getName()) 832 if (!vardata.getName())
829 { 833 {
830 sprintf(errmsg, "Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep); 834 std::string errmsg = llformat("Variable %s not in message %s block %s", vnamep, mCurrentRMessageData->mName, bnamep);
831 LL_ERRS("Messaging") << errmsg << llendl; 835 LL_ERRS("Messaging") << errmsg << llendl;
832 } 836 }
833 837
@@ -1378,8 +1382,8 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
1378 { 1382 {
1379 std::ostringstream str; 1383 std::ostringstream str;
1380 str << "MSG: -> " << host; 1384 str << "MSG: -> " << host;
1381 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 1385 std::string buffer;
1382 snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID()); /* Flawfinder: ignore */ 1386 buffer = llformat( "\t%6d\t%6d\t%6d ", mSendSize, buffer_length, cdp->getPacketOutID());
1383 str << buffer 1387 str << buffer
1384 << mMessageBuilder->getMessageName() 1388 << mMessageBuilder->getMessageName()
1385 << (mSendReliable ? " reliable " : ""); 1389 << (mSendReliable ? " reliable " : "");
@@ -1407,8 +1411,8 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
1407 { 1411 {
1408 std::ostringstream str; 1412 std::ostringstream str;
1409 str << "MSG: <- " << host; 1413 str << "MSG: <- " << host;
1410 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 1414 std::string buffer;
1411 snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ 1415 buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize: mMessageReader->getMessageSize()), mCurrentRecvPacketID);
1412 str << buffer 1416 str << buffer
1413 << nullToEmpty(mMessageReader->getMessageName()) 1417 << nullToEmpty(mMessageReader->getMessageName())
1414 << (recv_reliable ? " reliable" : "") 1418 << (recv_reliable ? " reliable" : "")
@@ -1512,8 +1516,8 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
1512 { 1516 {
1513 std::ostringstream str; 1517 std::ostringstream str;
1514 str << "MSG: <- " << host; 1518 str << "MSG: <- " << host;
1515 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 1519 std::string buffer;
1516 snprintf(buffer, MAX_STRING, "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID); /* Flawfinder: ignore */ 1520 buffer = llformat( "\t%6d\t%6d\t%6d ", mMessageReader->getMessageSize(), (mIncomingCompressedSize ? mIncomingCompressedSize : mMessageReader->getMessageSize()), mCurrentRecvPacketID);
1517 str << buffer 1521 str << buffer
1518 << nullToEmpty(mMessageReader->getMessageName()) 1522 << nullToEmpty(mMessageReader->getMessageName())
1519 << (recv_reliable ? " reliable" : "") 1523 << (recv_reliable ? " reliable" : "")
@@ -2086,20 +2090,18 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
2086// static 2090// static
2087void LLMessageSystem::processError(LLMessageSystem* msg, void**) 2091void LLMessageSystem::processError(LLMessageSystem* msg, void**)
2088{ 2092{
2089 char buffer[MTUBYTES];
2090 S32 error_code = 0; 2093 S32 error_code = 0;
2091 msg->getS32("Data", "Code", error_code); 2094 msg->getS32("Data", "Code", error_code);
2092 std::string error_token; 2095 std::string error_token;
2093 msg->getString("Data", "Token", MTUBYTES, buffer); 2096 msg->getString("Data", "Token", error_token);
2094 error_token.assign(buffer); 2097
2095 LLUUID error_id; 2098 LLUUID error_id;
2096 msg->getUUID("Data", "ID", error_id); 2099 msg->getUUID("Data", "ID", error_id);
2097 std::string error_system; 2100 std::string error_system;
2098 msg->getString("Data", "System", MTUBYTES, buffer); 2101 msg->getString("Data", "System", error_system);
2099 error_system.assign(buffer); 2102
2100 std::string error_message; 2103 std::string error_message;
2101 msg->getString("Data", "Message", MTUBYTES, buffer); 2104 msg->getString("Data", "Message", error_message);
2102 error_message.assign(buffer);
2103 2105
2104 LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - " 2106 LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - "
2105 << error_code << " " << error_token << " " << error_id << " \"" 2107 << error_code << " " << error_token << " " << error_id << " \""
@@ -2415,7 +2417,8 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
2415void dump_prehash_files() 2417void dump_prehash_files()
2416{ 2418{
2417 U32 i; 2419 U32 i;
2418 LLFILE* fp = LLFile::fopen("../../indra/llmessage/message_prehash.h", "w"); /* Flawfinder: ignore */ 2420 std::string filename("../../indra/llmessage/message_prehash.h");
2421 LLFILE* fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */
2419 if (fp) 2422 if (fp)
2420 { 2423 {
2421 fprintf( 2424 fprintf(
@@ -2445,7 +2448,8 @@ void dump_prehash_files()
2445 fprintf(fp, "\n\n#endif\n"); 2448 fprintf(fp, "\n\n#endif\n");
2446 fclose(fp); 2449 fclose(fp);
2447 } 2450 }
2448 fp = LLFile::fopen("../../indra/llmessage/message_prehash.cpp", "w"); /* Flawfinder: ignore */ 2451 filename = std::string("../../indra/llmessage/message_prehash.cpp");
2452 fp = LLFile::fopen(filename, "w"); /* Flawfinder: ignore */
2449 if (fp) 2453 if (fp)
2450 { 2454 {
2451 fprintf( 2455 fprintf(
@@ -2475,22 +2479,24 @@ void dump_prehash_files()
2475 } 2479 }
2476} 2480}
2477 2481
2478BOOL start_messaging_system( 2482bool start_messaging_system(
2479 const std::string& template_name, 2483 const std::string& template_name,
2480 U32 port, 2484 U32 port,
2481 S32 version_major, 2485 S32 version_major,
2482 S32 version_minor, 2486 S32 version_minor,
2483 S32 version_patch, 2487 S32 version_patch,
2484 BOOL b_dump_prehash_file, 2488 bool b_dump_prehash_file,
2485 const std::string& secret, 2489 const std::string& secret,
2486 const LLUseCircuitCodeResponder* responder) 2490 const LLUseCircuitCodeResponder* responder,
2491 bool failure_is_fatal)
2487{ 2492{
2488 gMessageSystem = new LLMessageSystem( 2493 gMessageSystem = new LLMessageSystem(
2489 template_name.c_str(), 2494 template_name,
2490 port, 2495 port,
2491 version_major, 2496 version_major,
2492 version_minor, 2497 version_minor,
2493 version_patch); 2498 version_patch,
2499 failure_is_fatal);
2494 g_shared_secret.assign(secret); 2500 g_shared_secret.assign(secret);
2495 2501
2496 if (!gMessageSystem) 2502 if (!gMessageSystem)
@@ -2579,79 +2585,79 @@ void LLMessageSystem::stopLogging()
2579 2585
2580void LLMessageSystem::summarizeLogs(std::ostream& str) 2586void LLMessageSystem::summarizeLogs(std::ostream& str)
2581{ 2587{
2582 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 2588 std::string buffer;
2583 char tmp_str[MAX_STRING]; /* Flawfinder: ignore */ 2589 std::string tmp_str;
2584 F32 run_time = mMessageSystemTimer.getElapsedTimeF32(); 2590 F32 run_time = mMessageSystemTimer.getElapsedTimeF32();
2585 str << "START MESSAGE LOG SUMMARY" << std::endl; 2591 str << "START MESSAGE LOG SUMMARY" << std::endl;
2586 snprintf(buffer, MAX_STRING, "Run time: %12.3f seconds", run_time); /* Flawfinder: ignore */ 2592 buffer = llformat( "Run time: %12.3f seconds", run_time);
2587 2593
2588 // Incoming 2594 // Incoming
2589 str << buffer << std::endl << "Incoming:" << std::endl; 2595 str << buffer << std::endl << "Incoming:" << std::endl;
2590 U64_to_str(mTotalBytesIn, tmp_str, sizeof(tmp_str)); 2596 tmp_str = U64_to_str(mTotalBytesIn);
2591 snprintf(buffer, MAX_STRING, "Total bytes received: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesIn * 0.008f) / run_time); /* Flawfinder: ignore */ 2597 buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time);
2592 str << buffer << std::endl; 2598 str << buffer << std::endl;
2593 U64_to_str(mPacketsIn, tmp_str, sizeof(tmp_str)); 2599 tmp_str = U64_to_str(mPacketsIn);
2594 snprintf(buffer, MAX_STRING, "Total packets received: %20s (%5.2f packets per second)", tmp_str, ((F32) mPacketsIn / run_time)); /* Flawfinder: ignore */ 2600 buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time));
2595 str << buffer << std::endl; 2601 str << buffer << std::endl;
2596 snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn); /* Flawfinder: ignore */ 2602 buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn);
2597 str << buffer << std::endl; 2603 str << buffer << std::endl;
2598 U64_to_str(mReliablePacketsIn, tmp_str, sizeof(tmp_str)); 2604 tmp_str = U64_to_str(mReliablePacketsIn);
2599 snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ 2605 buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1));
2600 str << buffer << std::endl; 2606 str << buffer << std::endl;
2601 U64_to_str(mCompressedPacketsIn, tmp_str, sizeof(tmp_str)); 2607 tmp_str = U64_to_str(mCompressedPacketsIn);
2602 snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1)); /* Flawfinder: ignore */ 2608 buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1));
2603 str << buffer << std::endl; 2609 str << buffer << std::endl;
2604 S64 savings = mUncompressedBytesIn - mCompressedBytesIn; 2610 S64 savings = mUncompressedBytesIn - mCompressedBytesIn;
2605 U64_to_str(savings, tmp_str, sizeof(tmp_str)); 2611 tmp_str = U64_to_str(savings);
2606 snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ 2612 buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
2607 str << buffer << std::endl; 2613 str << buffer << std::endl;
2608 U64_to_str(savings/(mCompressedPacketsIn +1), tmp_str, sizeof(tmp_str)); 2614 tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1));
2609 snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1)); /* Flawfinder: ignore */ 2615 buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1));
2610 str << buffer << std::endl; 2616 str << buffer << std::endl;
2611 U64_to_str(savings/(mPacketsIn+1), tmp_str, sizeof(tmp_str)); 2617 tmp_str = U64_to_str(savings/(mPacketsIn+1));
2612 snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f)); /* Flawfinder: ignore */ 2618 buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f));
2613 2619
2614 // Outgoing 2620 // Outgoing
2615 str << buffer << std::endl << std::endl << "Outgoing:" << std::endl; 2621 str << buffer << std::endl << std::endl << "Outgoing:" << std::endl;
2616 U64_to_str(mTotalBytesOut, tmp_str, sizeof(tmp_str)); 2622 tmp_str = U64_to_str(mTotalBytesOut);
2617 snprintf(buffer, MAX_STRING, "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str, ((F32)mTotalBytesOut * 0.008f) / run_time ); /* Flawfinder: ignore */ 2623 buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time );
2618 str << buffer << std::endl; 2624 str << buffer << std::endl;
2619 U64_to_str(mPacketsOut, tmp_str, sizeof(tmp_str)); 2625 tmp_str = U64_to_str(mPacketsOut);
2620 snprintf(buffer, MAX_STRING, "Total packets sent: %20s (%5.2f packets per second)", tmp_str, ((F32)mPacketsOut / run_time)); /* Flawfinder: ignore */ 2626 buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time));
2621 str << buffer << std::endl; 2627 str << buffer << std::endl;
2622 snprintf(buffer, MAX_STRING, "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut); /* Flawfinder: ignore */ 2628 buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut);
2623 str << buffer << std::endl; 2629 str << buffer << std::endl;
2624 U64_to_str(mReliablePacketsOut, tmp_str, sizeof(tmp_str)); 2630 tmp_str = U64_to_str(mReliablePacketsOut);
2625 snprintf(buffer, MAX_STRING, "Total reliable packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ 2631 buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1));
2626 str << buffer << std::endl; 2632 str << buffer << std::endl;
2627 U64_to_str(mCompressedPacketsOut, tmp_str, sizeof(tmp_str)); 2633 tmp_str = U64_to_str(mCompressedPacketsOut);
2628 snprintf(buffer, MAX_STRING, "Total compressed packets: %20s (%5.2f%%)", tmp_str, 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1)); /* Flawfinder: ignore */ 2634 buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1));
2629 str << buffer << std::endl; 2635 str << buffer << std::endl;
2630 savings = mUncompressedBytesOut - mCompressedBytesOut; 2636 savings = mUncompressedBytesOut - mCompressedBytesOut;
2631 U64_to_str(savings, tmp_str, sizeof(tmp_str)); 2637 tmp_str = U64_to_str(savings);
2632 snprintf(buffer, MAX_STRING, "Total compression savings: %20s bytes", tmp_str); /* Flawfinder: ignore */ 2638 buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
2633 str << buffer << std::endl; 2639 str << buffer << std::endl;
2634 U64_to_str(savings/(mCompressedPacketsOut +1), tmp_str, sizeof(tmp_str)); 2640 tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1));
2635 snprintf(buffer, MAX_STRING, "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str, ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1)); /* Flawfinder: ignore */ 2641 buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1));
2636 str << buffer << std::endl; 2642 str << buffer << std::endl;
2637 U64_to_str(savings/(mPacketsOut+1), tmp_str, sizeof(tmp_str)); 2643 tmp_str = U64_to_str(savings/(mPacketsOut+1));
2638 snprintf(buffer, MAX_STRING, "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str, ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f)); /* Flawfinder: ignore */ 2644 buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f));
2639 str << buffer << std::endl << std::endl; 2645 str << buffer << std::endl << std::endl;
2640 snprintf(buffer, MAX_STRING, "SendPacket failures: %20d", mSendPacketFailureCount); /* Flawfinder: ignore */ 2646 buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount);
2641 str << buffer << std::endl; 2647 str << buffer << std::endl;
2642 snprintf(buffer, MAX_STRING, "Dropped packets: %20d", mDroppedPackets); /* Flawfinder: ignore */ 2648 buffer = llformat( "Dropped packets: %20d", mDroppedPackets);
2643 str << buffer << std::endl; 2649 str << buffer << std::endl;
2644 snprintf(buffer, MAX_STRING, "Resent packets: %20d", mResentPackets); /* Flawfinder: ignore */ 2650 buffer = llformat( "Resent packets: %20d", mResentPackets);
2645 str << buffer << std::endl; 2651 str << buffer << std::endl;
2646 snprintf(buffer, MAX_STRING, "Failed reliable resends: %20d", mFailedResendPackets); /* Flawfinder: ignore */ 2652 buffer = llformat( "Failed reliable resends: %20d", mFailedResendPackets);
2647 str << buffer << std::endl; 2653 str << buffer << std::endl;
2648 snprintf(buffer, MAX_STRING, "Off-circuit rejected packets: %17d", mOffCircuitPackets); /* Flawfinder: ignore */ 2654 buffer = llformat( "Off-circuit rejected packets: %17d", mOffCircuitPackets);
2649 str << buffer << std::endl; 2655 str << buffer << std::endl;
2650 snprintf(buffer, MAX_STRING, "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets); /* Flawfinder: ignore */ 2656 buffer = llformat( "On-circuit invalid packets: %17d", mInvalidOnCircuitPackets);
2651 str << buffer << std::endl << std::endl; 2657 str << buffer << std::endl << std::endl;
2652 2658
2653 str << "Decoding: " << std::endl; 2659 str << "Decoding: " << std::endl;
2654 snprintf(buffer, MAX_STRING, "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg"); /* Flawfinder: ignore */ 2660 buffer = llformat( "%35s%10s%10s%10s%10s", "Message", "Count", "Time", "Max", "Avg");
2655 str << buffer << std:: endl; 2661 str << buffer << std:: endl;
2656 F32 avg; 2662 F32 avg;
2657 for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), 2663 for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
@@ -2662,7 +2668,7 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)
2662 if(mt->mTotalDecoded > 0) 2668 if(mt->mTotalDecoded > 0)
2663 { 2669 {
2664 avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded; 2670 avg = mt->mTotalDecodeTime / (F32)mt->mTotalDecoded;
2665 snprintf(buffer, MAX_STRING, "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg); /* Flawfinder: ignore */ 2671 buffer = llformat( "%35s%10u%10f%10f%10f", mt->mName, mt->mTotalDecoded, mt->mTotalDecodeTime, mt->mMaxDecodeTimePerMsg, avg);
2666 str << buffer << std::endl; 2672 str << buffer << std::endl;
2667 } 2673 }
2668 } 2674 }
@@ -3928,6 +3934,20 @@ void LLMessageSystem::getString(const char *block, const char *var,
3928 blocknum); 3934 blocknum);
3929} 3935}
3930 3936
3937void LLMessageSystem::getStringFast(const char *block, const char *var,
3938 std::string& outstr, S32 blocknum)
3939{
3940 mMessageReader->getString(block, var, outstr, blocknum);
3941}
3942
3943void LLMessageSystem::getString(const char *block, const char *var,
3944 std::string& outstr, S32 blocknum )
3945{
3946 getStringFast(LLMessageStringTable::getInstance()->getString(block),
3947 LLMessageStringTable::getInstance()->getString(var), outstr,
3948 blocknum);
3949}
3950
3931S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) 3951S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname)
3932{ 3952{
3933 return mMessageReader->getNumberOfBlocks(blockname); 3953 return mMessageReader->getNumberOfBlocks(blockname);
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index 00abff4..8807521 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -283,8 +283,9 @@ public:
283 283
284public: 284public:
285 // Read file and build message templates 285 // Read file and build message templates
286 LLMessageSystem(const char *filename, U32 port, S32 version_major, 286 LLMessageSystem(const std::string& filename, U32 port, S32 version_major,
287 S32 version_minor, S32 version_patch); 287 S32 version_minor, S32 version_patch,
288 bool failure_is_fatal = true);
288 289
289 ~LLMessageSystem(); 290 ~LLMessageSystem();
290 291
@@ -294,7 +295,7 @@ public:
294 // Read file and build message templates filename must point to a 295 // Read file and build message templates filename must point to a
295 // valid string which specifies the path of a valid linden 296 // valid string which specifies the path of a valid linden
296 // template. 297 // template.
297 void loadTemplateFile(const char* filename); 298 void loadTemplateFile(const std::string& filename, bool failure_is_fatal);
298 299
299 300
300 // methods for building, sending, receiving, and handling messages 301 // methods for building, sending, receiving, and handling messages
@@ -515,6 +516,8 @@ public:
515 void getIPPort( const char *block, const char *var, U16 &port, S32 blocknum = 0); 516 void getIPPort( const char *block, const char *var, U16 &port, S32 blocknum = 0);
516 void getStringFast( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); 517 void getStringFast( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0);
517 void getString( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0); 518 void getString( const char *block, const char *var, S32 buffer_size, char *buffer, S32 blocknum = 0);
519 void getStringFast( const char *block, const char *var, std::string& outstr, S32 blocknum = 0);
520 void getString( const char *block, const char *var, std::string& outstr, S32 blocknum = 0);
518 521
519 522
520 // Utility functions to generate a replay-resistant digest check 523 // Utility functions to generate a replay-resistant digest check
@@ -764,16 +767,17 @@ extern LLMessageSystem *gMessageSystem;
764 767
765// Must specific overall system version, which is used to determine 768// Must specific overall system version, which is used to determine
766// if a patch is available in the message template checksum verification. 769// if a patch is available in the message template checksum verification.
767// Return TRUE if able to initialize system. 770// Return true if able to initialize system.
768BOOL start_messaging_system( 771bool start_messaging_system(
769 const std::string& template_name, 772 const std::string& template_name,
770 U32 port, 773 U32 port,
771 S32 version_major, 774 S32 version_major,
772 S32 version_minor, 775 S32 version_minor,
773 S32 version_patch, 776 S32 version_patch,
774 BOOL b_dump_prehash_file, 777 bool b_dump_prehash_file,
775 const std::string& secret, 778 const std::string& secret,
776 const LLUseCircuitCodeResponder* responder = NULL); 779 const LLUseCircuitCodeResponder* responder = NULL,
780 bool failure_is_fatal = true);
777 781
778void end_messaging_system(); 782void end_messaging_system();
779 783
diff --git a/linden/indra/llmessage/message_prehash.cpp b/linden/indra/llmessage/message_prehash.cpp
index 745271f..2ac1319 100644
--- a/linden/indra/llmessage/message_prehash.cpp
+++ b/linden/indra/llmessage/message_prehash.cpp
@@ -1371,4 +1371,7 @@ char* _PREHASH_OwnerMask = LLMessageStringTable::getInstance()->getString("Owner
1371char* _PREHASH_TransferInventoryAck = LLMessageStringTable::getInstance()->getString("TransferInventoryAck"); 1371char* _PREHASH_TransferInventoryAck = LLMessageStringTable::getInstance()->getString("TransferInventoryAck");
1372char* _PREHASH_RegionDenyAgeUnverified = LLMessageStringTable::getInstance()->getString("RegionDenyAgeUnverified"); 1372char* _PREHASH_RegionDenyAgeUnverified = LLMessageStringTable::getInstance()->getString("RegionDenyAgeUnverified");
1373char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getString("AgeVerificationBlock"); 1373char* _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getString("AgeVerificationBlock");
1374char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord");
1375char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord");
1376char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex");
1374 1377
diff --git a/linden/indra/llmessage/message_prehash.h b/linden/indra/llmessage/message_prehash.h
index e65d539..0ee02be 100644
--- a/linden/indra/llmessage/message_prehash.h
+++ b/linden/indra/llmessage/message_prehash.h
@@ -1371,6 +1371,8 @@ extern char * _PREHASH_OwnerMask;
1371extern char * _PREHASH_TransferInventoryAck; 1371extern char * _PREHASH_TransferInventoryAck;
1372extern char * _PREHASH_RegionDenyAgeUnverified; 1372extern char * _PREHASH_RegionDenyAgeUnverified;
1373extern char * _PREHASH_AgeVerificationBlock; 1373extern char * _PREHASH_AgeVerificationBlock;
1374 1374extern char * _PREHASH_UCoord;
1375extern char * _PREHASH_VCoord;
1376extern char * _PREHASH_FaceIndex;
1375 1377
1376#endif 1378#endif