Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
2abfc149
Commit
2abfc149
authored
9 years ago
by
Rider Linden
Browse files
Options
Downloads
Patches
Plain Diff
Marketplace vendor outbox. Incomplete conversion. Still issues with redirection.
parent
68da6fa8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/newview/llmarketplacefunctions.cpp
+161
-11
161 additions, 11 deletions
indra/newview/llmarketplacefunctions.cpp
indra/newview/llviewermedia.cpp
+12
-0
12 additions, 0 deletions
indra/newview/llviewermedia.cpp
indra/newview/llviewermedia.h
+1
-0
1 addition, 0 deletions
indra/newview/llviewermedia.h
with
174 additions
and
11 deletions
indra/newview/llmarketplacefunctions.cpp
+
161
−
11
View file @
2abfc149
...
@@ -36,7 +36,9 @@
...
@@ -36,7 +36,9 @@
#include
"llviewercontrol.h"
#include
"llviewercontrol.h"
#include
"llviewermedia.h"
#include
"llviewermedia.h"
#include
"llviewernetwork.h"
#include
"llviewernetwork.h"
#include
"lleventcoro.h"
#include
"llcoros.h"
#include
"llcorehttputil.h"
//
//
// Helpers
// Helpers
...
@@ -117,11 +119,76 @@ namespace LLMarketplaceImport
...
@@ -117,11 +119,76 @@ namespace LLMarketplaceImport
static
S32
sImportResultStatus
=
0
;
static
S32
sImportResultStatus
=
0
;
static
LLSD
sImportResults
=
LLSD
::
emptyMap
();
static
LLSD
sImportResults
=
LLSD
::
emptyMap
();
#if 0
static LLTimer slmGetTimer;
static LLTimer slmGetTimer;
static LLTimer slmPostTimer;
static LLTimer slmPostTimer;
#endif
// Responders
// Responders
#if 1
void
marketplacePostCoro
(
LLCoros
::
self
&
self
,
std
::
string
url
)
{
LLCore
::
HttpRequest
::
policy_t
httpPolicy
(
LLCore
::
HttpRequest
::
DEFAULT_POLICY_ID
);
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
ptr_t
httpAdapter
(
new
LLCoreHttpUtil
::
HttpCoroutineAdapter
(
"marketplacePostCoro"
,
httpPolicy
));
LLCore
::
HttpRequest
::
ptr_t
httpRequest
(
new
LLCore
::
HttpRequest
);
LLCore
::
HttpHeaders
::
ptr_t
httpHeaders
(
new
LLCore
::
HttpHeaders
);
LLCore
::
HttpOptions
::
ptr_t
httpOpts
(
new
LLCore
::
HttpOptions
);
httpOpts
->
setWantHeaders
(
true
);
httpOpts
->
setFollowRedirects
(
false
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_ACCEPT
,
"*/*"
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_CONNECTION
,
"Keep-Alive"
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_COOKIE
,
sMarketplaceCookie
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_CONTENT_TYPE
,
HTTP_CONTENT_XML
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_USER_AGENT
,
LLViewerMedia
::
getCurrentUserAgent
());
LLSD
result
=
httpAdapter
->
postAndYield
(
self
,
httpRequest
,
url
,
LLSD
(),
httpOpts
,
httpHeaders
);
LLSD
httpResults
=
result
[
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
HTTP_RESULTS
];
LLCore
::
HttpStatus
status
=
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
getStatusFromLLSD
(
httpResults
);
S32
httpCode
=
status
.
getType
();
if
((
httpCode
==
MarketplaceErrorCodes
::
IMPORT_REDIRECT
)
||
(
httpCode
==
MarketplaceErrorCodes
::
IMPORT_AUTHENTICATION_ERROR
)
||
// MAINT-2301 : we determined we can safely ignore that error in that context
(
httpCode
==
MarketplaceErrorCodes
::
IMPORT_JOB_TIMEOUT
))
{
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
))
{
LL_INFOS
()
<<
" SLM POST : Ignoring time out status and treating it as success"
<<
LL_ENDL
;
}
httpCode
=
MarketplaceErrorCodes
::
IMPORT_DONE
;
}
if
(
httpCode
>=
MarketplaceErrorCodes
::
IMPORT_BAD_REQUEST
)
{
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
))
{
LL_INFOS
()
<<
" SLM POST clearing marketplace cookie due to client or server error"
<<
LL_ENDL
;
}
sMarketplaceCookie
.
clear
();
}
sImportInProgress
=
(
httpCode
==
MarketplaceErrorCodes
::
IMPORT_DONE
);
sImportPostPending
=
false
;
sImportResultStatus
=
httpCode
;
{
std
::
stringstream
str
;
LLSDSerialize
::
toPrettyXML
(
result
,
str
);
LL_INFOS
()
<<
"Full results:
\n
"
<<
str
.
str
()
<<
"
\n
"
<<
LL_ENDL
;
}
result
.
erase
(
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
HTTP_RESULTS
);
sImportId
=
result
;
}
#else
class
LLImportPostResponder
:
public
LLHTTPClient
::
Responder
class
LLImportPostResponder
:
public
LLHTTPClient
::
Responder
{
{
LOG_CLASS
(
LLImportPostResponder
);
LOG_CLASS
(
LLImportPostResponder
);
...
@@ -167,7 +234,75 @@ namespace LLMarketplaceImport
...
@@ -167,7 +234,75 @@ namespace LLMarketplaceImport
sImportId
=
getContent
();
sImportId
=
getContent
();
}
}
};
};
#endif
#if 1
void
marketplaceGetCoro
(
LLCoros
::
self
&
self
,
std
::
string
url
,
bool
buildHeaders
)
{
LLCore
::
HttpRequest
::
policy_t
httpPolicy
(
LLCore
::
HttpRequest
::
DEFAULT_POLICY_ID
);
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
ptr_t
httpAdapter
(
new
LLCoreHttpUtil
::
HttpCoroutineAdapter
(
"marketplacePostCoro"
,
httpPolicy
));
LLCore
::
HttpRequest
::
ptr_t
httpRequest
(
new
LLCore
::
HttpRequest
);
LLCore
::
HttpHeaders
::
ptr_t
httpHeaders
;
LLCore
::
HttpOptions
::
ptr_t
httpOpts
(
new
LLCore
::
HttpOptions
);
httpOpts
->
setWantHeaders
(
true
);
httpOpts
->
setFollowRedirects
(
false
);
if
(
buildHeaders
)
{
httpHeaders
=
LLCore
::
HttpHeaders
::
ptr_t
(
new
LLCore
::
HttpHeaders
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_ACCEPT
,
"*/*"
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_COOKIE
,
sMarketplaceCookie
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_CONTENT_TYPE
,
HTTP_CONTENT_LLSD_XML
);
httpHeaders
->
append
(
HTTP_OUT_HEADER_USER_AGENT
,
LLViewerMedia
::
getCurrentUserAgent
());
}
else
{
httpHeaders
=
LLViewerMedia
::
getHttpHeaders
();
}
LLSD
result
=
httpAdapter
->
getAndYield
(
self
,
httpRequest
,
url
,
httpOpts
,
httpHeaders
);
LLSD
httpResults
=
result
[
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
HTTP_RESULTS
];
LLCore
::
HttpStatus
status
=
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
getStatusFromLLSD
(
httpResults
);
LLSD
resultHeaders
=
httpResults
[
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
HTTP_RESULTS_HEADERS
];
if
(
sMarketplaceCookie
.
empty
()
&&
resultHeaders
.
has
(
HTTP_IN_HEADER_SET_COOKIE
))
{
sMarketplaceCookie
=
resultHeaders
[
HTTP_IN_HEADER_SET_COOKIE
].
asString
();
}
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions
// ACME-1221 : Do not clear the cookie on IMPORT_NOT_FOUND : Happens for newly created Merchant accounts that are initially empty
S32
httpCode
=
status
.
getType
();
if
((
httpCode
>=
MarketplaceErrorCodes
::
IMPORT_BAD_REQUEST
)
&&
(
httpCode
!=
MarketplaceErrorCodes
::
IMPORT_DONE_WITH_ERRORS
)
&&
(
httpCode
!=
MarketplaceErrorCodes
::
IMPORT_NOT_FOUND
))
{
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
))
{
LL_INFOS
()
<<
" SLM GET clearing marketplace cookie due to client or server error"
<<
LL_ENDL
;
}
sMarketplaceCookie
.
clear
();
}
else
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
)
&&
(
httpCode
>=
MarketplaceErrorCodes
::
IMPORT_BAD_REQUEST
))
{
LL_INFOS
()
<<
" SLM GET : Got error status = "
<<
httpCode
<<
", but marketplace cookie not cleared."
<<
LL_ENDL
;
}
sImportInProgress
=
(
httpCode
==
MarketplaceErrorCodes
::
IMPORT_PROCESSING
);
sImportGetPending
=
false
;
sImportResultStatus
=
httpCode
;
result
.
erase
(
LLCoreHttpUtil
::
HttpCoroutineAdapter
::
HTTP_RESULTS
);
sImportResults
=
result
;
}
#else
class
LLImportGetResponder
:
public
LLHTTPClient
::
Responder
class
LLImportGetResponder
:
public
LLHTTPClient
::
Responder
{
{
LOG_CLASS
(
LLImportGetResponder
);
LOG_CLASS
(
LLImportGetResponder
);
...
@@ -193,7 +328,7 @@ namespace LLMarketplaceImport
...
@@ -193,7 +328,7 @@ namespace LLMarketplaceImport
}
}
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions
// ACME-1221 : Do not clear the cookie on IMPORT_NOT_FOUND : Happens for newly created Merchant accounts that are initally empty
// ACME-1221 : Do not clear the cookie on IMPORT_NOT_FOUND : Happens for newly created Merchant accounts that are init
i
ally empty
S32
status
=
getStatus
();
S32
status
=
getStatus
();
if
((
status
>=
MarketplaceErrorCodes
::
IMPORT_BAD_REQUEST
)
&&
if
((
status
>=
MarketplaceErrorCodes
::
IMPORT_BAD_REQUEST
)
&&
(
status
!=
MarketplaceErrorCodes
::
IMPORT_DONE_WITH_ERRORS
)
&&
(
status
!=
MarketplaceErrorCodes
::
IMPORT_DONE_WITH_ERRORS
)
&&
...
@@ -216,6 +351,7 @@ namespace LLMarketplaceImport
...
@@ -216,6 +351,7 @@ namespace LLMarketplaceImport
sImportResults
=
getContent
();
sImportResults
=
getContent
();
}
}
};
};
#endif
// Basic API
// Basic API
...
@@ -266,8 +402,13 @@ namespace LLMarketplaceImport
...
@@ -266,8 +402,13 @@ namespace LLMarketplaceImport
sImportGetPending
=
true
;
sImportGetPending
=
true
;
std
::
string
url
=
getInventoryImportURL
();
std
::
string
url
=
getInventoryImportURL
();
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
))
#if 1
LLCoros
::
instance
().
launch
(
"marketplaceGetCoro"
,
boost
::
bind
(
&
marketplaceGetCoro
,
_1
,
url
,
false
));
#else
if
(
gSavedSettings
.
getBOOL
(
"InventoryOutboxLogging"
))
{
{
LL_INFOS
()
<<
" SLM GET: establishMarketplaceSessionCookie, LLHTTPClient::get, url = "
<<
url
<<
LL_ENDL
;
LL_INFOS
()
<<
" SLM GET: establishMarketplaceSessionCookie, LLHTTPClient::get, url = "
<<
url
<<
LL_ENDL
;
LLSD
headers
=
LLViewerMedia
::
getHeaders
();
LLSD
headers
=
LLViewerMedia
::
getHeaders
();
...
@@ -279,7 +420,7 @@ namespace LLMarketplaceImport
...
@@ -279,7 +420,7 @@ namespace LLMarketplaceImport
slmGetTimer
.
start
();
slmGetTimer
.
start
();
LLHTTPClient
::
get
(
url
,
new
LLImportGetResponder
(),
LLViewerMedia
::
getHeaders
());
LLHTTPClient
::
get
(
url
,
new
LLImportGetResponder
(),
LLViewerMedia
::
getHeaders
());
#endif
return
true
;
return
true
;
}
}
...
@@ -296,6 +437,11 @@ namespace LLMarketplaceImport
...
@@ -296,6 +437,11 @@ namespace LLMarketplaceImport
url
+=
sImportId
.
asString
();
url
+=
sImportId
.
asString
();
#if 1
LLCoros
::
instance
().
launch
(
"marketplaceGetCoro"
,
boost
::
bind
(
&
marketplaceGetCoro
,
_1
,
url
,
true
));
#else
// Make the headers for the post
// Make the headers for the post
LLSD
headers
=
LLSD
::
emptyMap
();
LLSD
headers
=
LLSD
::
emptyMap
();
headers
[
HTTP_OUT_HEADER_ACCEPT
]
=
"*/*"
;
headers
[
HTTP_OUT_HEADER_ACCEPT
]
=
"*/*"
;
...
@@ -315,7 +461,7 @@ namespace LLMarketplaceImport
...
@@ -315,7 +461,7 @@ namespace LLMarketplaceImport
slmGetTimer
.
start
();
slmGetTimer
.
start
();
LLHTTPClient
::
get
(
url
,
new
LLImportGetResponder
(),
headers
);
LLHTTPClient
::
get
(
url
,
new
LLImportGetResponder
(),
headers
);
#endif
return
true
;
return
true
;
}
}
...
@@ -334,6 +480,11 @@ namespace LLMarketplaceImport
...
@@ -334,6 +480,11 @@ namespace LLMarketplaceImport
std
::
string
url
=
getInventoryImportURL
();
std
::
string
url
=
getInventoryImportURL
();
#if 1
LLCoros
::
instance
().
launch
(
"marketplacePostCoro"
,
boost
::
bind
(
&
marketplacePostCoro
,
_1
,
url
));
#else
// Make the headers for the post
// Make the headers for the post
LLSD
headers
=
LLSD
::
emptyMap
();
LLSD
headers
=
LLSD
::
emptyMap
();
headers
[
HTTP_OUT_HEADER_ACCEPT
]
=
"*/*"
;
headers
[
HTTP_OUT_HEADER_ACCEPT
]
=
"*/*"
;
...
@@ -353,7 +504,7 @@ namespace LLMarketplaceImport
...
@@ -353,7 +504,7 @@ namespace LLMarketplaceImport
slmPostTimer
.
start
();
slmPostTimer
.
start
();
LLHTTPClient
::
post
(
url
,
LLSD
(),
new
LLImportPostResponder
(),
headers
);
LLHTTPClient
::
post
(
url
,
LLSD
(),
new
LLImportPostResponder
(),
headers
);
#endif
return
true
;
return
true
;
}
}
}
}
...
@@ -362,7 +513,6 @@ namespace LLMarketplaceImport
...
@@ -362,7 +513,6 @@ namespace LLMarketplaceImport
//
//
// Interface class
// Interface class
//
//
static
const
F32
MARKET_IMPORTER_UPDATE_FREQUENCY
=
1.0
f
;
static
const
F32
MARKET_IMPORTER_UPDATE_FREQUENCY
=
1.0
f
;
//static
//static
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llviewermedia.cpp
+
12
−
0
View file @
2abfc149
...
@@ -1205,6 +1205,18 @@ LLSD LLViewerMedia::getHeaders()
...
@@ -1205,6 +1205,18 @@ LLSD LLViewerMedia::getHeaders()
return
headers
;
return
headers
;
}
}
LLCore
::
HttpHeaders
::
ptr_t
LLViewerMedia
::
getHttpHeaders
()
{
LLCore
::
HttpHeaders
::
ptr_t
headers
(
new
LLCore
::
HttpHeaders
);
headers
->
append
(
HTTP_OUT_HEADER_ACCEPT
,
"*/*"
);
headers
->
append
(
HTTP_OUT_HEADER_CONTENT_TYPE
,
HTTP_CONTENT_XML
);
headers
->
append
(
HTTP_OUT_HEADER_COOKIE
,
sOpenIDCookie
);
headers
->
append
(
HTTP_OUT_HEADER_USER_AGENT
,
getCurrentUserAgent
());
return
headers
;
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// static
// static
void
LLViewerMedia
::
setOpenIDCookie
()
void
LLViewerMedia
::
setOpenIDCookie
()
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llviewermedia.h
+
1
−
0
View file @
2abfc149
...
@@ -164,6 +164,7 @@ class LLViewerMedia
...
@@ -164,6 +164,7 @@ class LLViewerMedia
static
void
setOnlyAudibleMediaTextureID
(
const
LLUUID
&
texture_id
);
static
void
setOnlyAudibleMediaTextureID
(
const
LLUUID
&
texture_id
);
static
LLSD
getHeaders
();
static
LLSD
getHeaders
();
static
LLCore
::
HttpHeaders
::
ptr_t
getHttpHeaders
();
private:
private:
static
void
setOpenIDCookie
();
static
void
setOpenIDCookie
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment