Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
8e287210
Commit
8e287210
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
The read callback can now return CURL_READFUNC_ABORT to stop a transfer.
parent
8d212056
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
lib/file.c
+6
-1
6 additions, 1 deletion
lib/file.c
lib/transfer.c
+14
-3
14 additions, 3 deletions
lib/transfer.c
lib/transfer.h
+1
-1
1 addition, 1 deletion
lib/transfer.h
with
21 additions
and
5 deletions
lib/file.c
+
6
−
1
View file @
8e287210
...
...
@@ -218,7 +218,12 @@ static CURLcode file_upload(struct connectdata *conn)
Curl_pgrsSetUploadSize
(
data
,
data
->
set
.
infilesize
);
while
(
res
==
CURLE_OK
)
{
nread
=
Curl_fillreadbuffer
(
conn
,
BUFSIZE
);
int
readcount
;
res
=
Curl_fillreadbuffer
(
conn
,
BUFSIZE
,
&
readcount
);
if
(
res
)
return
res
;
nread
=
(
size_t
)
readcount
;
if
(
nread
<=
0
)
break
;
...
...
This diff is collapsed.
Click to expand it.
lib/transfer.c
+
14
−
3
View file @
8e287210
...
...
@@ -125,8 +125,9 @@ static struct timeval notimeout={0,0};
* This function will call the read callback to fill our buffer with data
* to upload.
*/
int
Curl_fillreadbuffer
(
struct
connectdata
*
conn
,
int
bytes
)
CURLcode
Curl_fillreadbuffer
(
struct
connectdata
*
conn
,
int
bytes
,
int
*
nreadp
)
{
struct
SessionHandle
*
data
=
conn
->
data
;
int
buffersize
=
bytes
;
int
nread
;
...
...
@@ -139,6 +140,11 @@ int Curl_fillreadbuffer(struct connectdata *conn, int bytes)
nread
=
conn
->
fread
(
conn
->
upload_fromhere
,
1
,
buffersize
,
conn
->
fread_in
);
if
(
nread
==
CURL_READFUNC_ABORT
)
{
failf
(
data
,
"operation aborted by callback
\n
"
);
return
CURLE_ABORTED_BY_CALLBACK
;
}
if
(
!
conn
->
bits
.
forbidchunk
&&
conn
->
bits
.
upload_chunky
)
{
/* if chunked Transfer-Encoding */
char
hexbuffer
[
11
];
...
...
@@ -161,7 +167,10 @@ int Curl_fillreadbuffer(struct connectdata *conn, int bytes)
nread
+=
2
;
/* for the added CRLF */
}
return
nread
;
*
nreadp
=
nread
;
return
CURLE_OK
;
}
/*
...
...
@@ -1131,7 +1140,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
break
;
}
nread
=
Curl_fillreadbuffer
(
conn
,
BUFSIZE
);
result
=
Curl_fillreadbuffer
(
conn
,
BUFSIZE
,
&
nread
);
if
(
result
)
return
result
;
}
else
nread
=
0
;
/* we're done uploading/reading */
...
...
This diff is collapsed.
Click to expand it.
lib/transfer.h
+
1
−
1
View file @
8e287210
...
...
@@ -35,7 +35,7 @@ void Curl_single_fdset(struct connectdata *conn,
int
*
max_fd
);
CURLcode
Curl_readwrite_init
(
struct
connectdata
*
conn
);
int
Curl_fillreadbuffer
(
struct
connectdata
*
conn
,
int
bytes
);
CURLcode
Curl_fillreadbuffer
(
struct
connectdata
*
conn
,
int
bytes
,
int
*
nreadp
);
/* This sets up a forthcoming transfer */
CURLcode
...
...
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