Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
fcd7a80f
Commit
fcd7a80f
authored
9 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Simplified CTACopyCmd::formatCommandPath()
parent
f74ddaad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmdline/CTACmd.cpp
+11
-12
11 additions, 12 deletions
cmdline/CTACmd.cpp
cmdline/CTACmd.hpp
+9
-2
9 additions, 2 deletions
cmdline/CTACmd.hpp
with
20 additions
and
14 deletions
cmdline/CTACmd.cpp
+
11
−
12
View file @
fcd7a80f
...
...
@@ -86,18 +86,9 @@ int CTACopyCmd::sendCommand(const int argc, const char **argv) const {
//------------------------------------------------------------------------------
std
::
string
CTACopyCmd
::
formatCommandPath
(
const
int
argc
,
const
char
**
argv
)
const
{
std
::
string
cmdPath
=
"root://localhost:10955//"
;
std
::
string
arg
=
encode
(
std
::
string
(
argv
[
0
]));
replaceAll
(
arg
,
"/"
,
"_"
);
//need to add this because xroot removes consecutive slashes, and the
//cryptopp base64 algorithm may produce consecutive slashes. This is solved
//in cryptopp-5.6.3 (using Base64URLEncoder instead of Base64Encoder) but we
//currently have cryptopp-5.6.2. To be changed in the future...
cmdPath
+=
arg
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
std
::
string
arg
=
encode
(
std
::
string
(
argv
[
i
]));
replaceAll
(
arg
,
"/"
,
"_"
);
cmdPath
+=
"&"
;
cmdPath
+=
arg
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
i
)
cmdPath
+=
"&"
;
cmdPath
+=
encode
(
std
::
string
(
argv
[
i
]));
}
return
cmdPath
;
}
...
...
@@ -122,5 +113,13 @@ std::string CTACopyCmd::encode(const std::string msg) const {
std
::
string
ret
;
const
bool
noNewLineInBase64Output
=
false
;
CryptoPP
::
StringSource
ss1
(
msg
,
true
,
new
CryptoPP
::
Base64Encoder
(
new
CryptoPP
::
StringSink
(
ret
),
noNewLineInBase64Output
));
// need to replace slashes ('/') with underscores ('_') because xroot removes
// consecutive slashes, and the cryptopp base64 algorithm may produce
// consecutive slashes. This is solved in cryptopp-5.6.3 (using
// Base64URLEncoder instead of Base64Encoder) but we currently have
// cryptopp-5.6.2. To be changed in the future...
replaceAll
(
ret
,
"/"
,
"_"
);
return
ret
;
}
This diff is collapsed.
Click to expand it.
cmdline/CTACmd.hpp
+
9
−
2
View file @
fcd7a80f
...
...
@@ -38,7 +38,7 @@ public:
*/
int
main
(
const
int
argc
,
const
char
**
argv
)
const
throw
();
pr
otec
te
d
:
pr
iva
te:
/**
* Sends the command and waits for the reply
...
...
@@ -68,7 +68,14 @@ protected:
void
replaceAll
(
std
::
string
&
str
,
const
std
::
string
&
from
,
const
std
::
string
&
to
)
const
;
/**
* Encodes a string in base 64
* Encodes a string in base 64 and replaces slatches ('/') in the result
* with underscores ('_').
*
* Need to replace slashes ('/') with underscores ('_') because xroot removes
* consecutive slashes, and the cryptopp base64 algorithm may produce
* consecutive slashes. This is solved in cryptopp-5.6.3 (using
* Base64URLEncoder instead of Base64Encoder) but we currently have
* cryptopp-5.6.2. To be changed in the future...
*
* @param msg string to encode
* @return encoded string
...
...
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