|
|
|
@ -85,10 +85,14 @@ func (this *StarCurl) CurlWithFile(url string, postdata map[string]string, formn
|
|
|
|
|
fpdst.Write([]byte(header))
|
|
|
|
|
go func() {
|
|
|
|
|
for {
|
|
|
|
|
bufs := make([]byte, 1048576)
|
|
|
|
|
bufs := make([]byte, 393213)
|
|
|
|
|
n, err = fpsrc.Read(bufs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err == io.EOF {
|
|
|
|
|
if n != 0 {
|
|
|
|
|
fpdst.Write(bufs[0:n])
|
|
|
|
|
go shell(float64(sum+n) / filebig * 100)
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
@ -99,7 +103,6 @@ func (this *StarCurl) CurlWithFile(url string, postdata map[string]string, formn
|
|
|
|
|
}
|
|
|
|
|
fpdst.Write(endbytes)
|
|
|
|
|
fpdst.Write(nil)
|
|
|
|
|
|
|
|
|
|
}()
|
|
|
|
|
this.CircleBuffer = fpdst
|
|
|
|
|
this.ReqHeader.Set("Content-Type", "multipart/form-data;boundary="+boundary)
|
|
|
|
@ -134,10 +137,14 @@ func (this *StarCurl) CurlWithFileByMemory(url string, postdata map[string]strin
|
|
|
|
|
filebig := float64(fpstat.Size())
|
|
|
|
|
sum, n := 0, 0
|
|
|
|
|
for {
|
|
|
|
|
bufs := make([]byte, 1048576)
|
|
|
|
|
bufs := make([]byte, 393213)
|
|
|
|
|
n, err = fpsrc.Read(bufs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err == io.EOF {
|
|
|
|
|
if n != 0 {
|
|
|
|
|
fpdst.Write(bufs[0:n])
|
|
|
|
|
go shell(float64(sum+n) / filebig * 100)
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
@ -231,11 +238,14 @@ func (this *StarCurl) CurlDataToFile(url string, postdata []byte, method, fpath
|
|
|
|
|
}
|
|
|
|
|
var n, sum int = 0, 0
|
|
|
|
|
for {
|
|
|
|
|
buf := make([]byte, 1048576)
|
|
|
|
|
buf := make([]byte, 393213)
|
|
|
|
|
n, err = resp.Body.Read(buf)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err == io.EOF {
|
|
|
|
|
err = nil
|
|
|
|
|
if n != 0 {
|
|
|
|
|
fpsrc.Write(buf[0:n])
|
|
|
|
|
}
|
|
|
|
|
go shell(100.00)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|