Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
shenyizhong
/
minsync
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b66203ce
authored
Jan 10, 2022
by
shenyizhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* code review
1 parent
f351eb69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
src/httpcli/httpcli.go
src/httpcli/httpcli.go
View file @
b66203c
...
@@ -140,6 +140,7 @@ func Upload(node *nodetree.NodeLoc) {
...
@@ -140,6 +140,7 @@ func Upload(node *nodetree.NodeLoc) {
}
}
log
.
Printf
(
"curl %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v
\n
"
,
strCmd01
,
strCmd02
,
strCmd03
,
strCmd04
,
strCmd05
,
strCmd06
,
strCmd07
,
strCmd08
,
strCmd09
,
strCmd10
)
log
.
Printf
(
"curl %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v
\n
"
,
strCmd01
,
strCmd02
,
strCmd03
,
strCmd04
,
strCmd05
,
strCmd06
,
strCmd07
,
strCmd08
,
strCmd09
,
strCmd10
)
fmt
.
Printf
(
"%v
\n
"
,
node
.
Path
)
cmd
:=
exec
.
Command
(
"curl"
,
strCmd01
,
"-F"
,
strCmd02
,
"-F"
,
strCmd03
,
"-F"
,
strCmd04
,
"-F"
,
strCmd05
,
"-F"
,
strCmd06
,
"-F"
,
strCmd07
,
"-F"
,
strCmd08
,
"-F"
,
strCmd09
,
"-F"
,
strCmd10
)
cmd
:=
exec
.
Command
(
"curl"
,
strCmd01
,
"-F"
,
strCmd02
,
"-F"
,
strCmd03
,
"-F"
,
strCmd04
,
"-F"
,
strCmd05
,
"-F"
,
strCmd06
,
"-F"
,
strCmd07
,
"-F"
,
strCmd08
,
"-F"
,
strCmd09
,
"-F"
,
strCmd10
)
stdout
,
err
:=
cmd
.
StdoutPipe
()
stdout
,
err
:=
cmd
.
StdoutPipe
()
...
@@ -155,7 +156,6 @@ func Upload(node *nodetree.NodeLoc) {
...
@@ -155,7 +156,6 @@ func Upload(node *nodetree.NodeLoc) {
if
opBytes
,
err
:=
ioutil
.
ReadAll
(
stdout
);
err
!=
nil
{
if
opBytes
,
err
:=
ioutil
.
ReadAll
(
stdout
);
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
else
{
}
else
{
fmt
.
Printf
(
"[%v]
\n
"
,
node
.
Path
)
log
.
Println
(
string
(
opBytes
))
log
.
Println
(
string
(
opBytes
))
}
}
}
}
...
@@ -235,7 +235,7 @@ func Download(node *nodetree.NodeRemot) error {
...
@@ -235,7 +235,7 @@ func Download(node *nodetree.NodeRemot) error {
log
.
Printf
(
"wget -O %v
\"
%v
\"
"
,
strDstFile
,
jsonRes
.
Data
.
Url
)
log
.
Printf
(
"wget -O %v
\"
%v
\"
"
,
strDstFile
,
jsonRes
.
Data
.
Url
)
fmt
.
Printf
(
"
[%v] "
,
strDstFile
)
fmt
.
Printf
(
"
%v "
,
nodetree
.
StrSrc
+
tmpStrs
[
1
]
)
res
,
err
:=
http
.
Get
(
jsonRes
.
Data
.
Url
)
res
,
err
:=
http
.
Get
(
jsonRes
.
Data
.
Url
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -243,14 +243,12 @@ func Download(node *nodetree.NodeRemot) error {
...
@@ -243,14 +243,12 @@ func Download(node *nodetree.NodeRemot) error {
return
err
return
err
}
}
defer
res
.
Body
.
Close
()
defer
res
.
Body
.
Close
()
// 获得get请求响应的reader对象
reader
:=
bufio
.
NewReaderSize
(
res
.
Body
,
32
*
1024
)
reader
:=
bufio
.
NewReaderSize
(
res
.
Body
,
32
*
1024
)
file
,
err
:=
os
.
Create
(
strDstFile
)
file
,
err
:=
os
.
Create
(
strDstFile
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
// 获得文件的writer对象
writer
:=
bufio
.
NewWriter
(
file
)
writer
:=
bufio
.
NewWriter
(
file
)
written
,
_
:=
io
.
Copy
(
writer
,
reader
)
written
,
_
:=
io
.
Copy
(
writer
,
reader
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment