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
91e4da7d
Commit
91e4da7d
authored
24 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
initial chunked transfer-encoding support
parent
2873c181
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
lib/transfer.c
+26
-2
26 additions, 2 deletions
lib/transfer.c
lib/urldata.h
+1
-0
1 addition, 0 deletions
lib/urldata.h
with
27 additions
and
2 deletions
lib/transfer.c
+
26
−
2
View file @
91e4da7d
...
...
@@ -379,10 +379,22 @@ _Transfer(struct connectdata *c_conn)
*/
conn
->
bits
.
close
=
TRUE
;
/* close when done */
}
else
if
(
strnequal
(
"Transfer-Encoding: chunked"
,
p
,
strlen
(
"Transfer-Encoding: chunked"
)))
{
/*
* [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
* means that the server will send a series of "chunks". Each
* chunk starts with line with info (including size of the
* coming block) (terminated with CRLF), then a block of data
* with the previously mentioned size. There can be any amount
* of chunks, and a chunk-data set to zero signals the
* end-of-chunks. */
conn
->
bits
.
chunk
=
TRUE
;
/* chunks coming our way */
}
else
if
(
strnequal
(
"Content-Range"
,
p
,
13
))
{
if
(
sscanf
(
p
+
13
,
": bytes %d-"
,
&
offset
)
||
sscanf
(
p
+
13
,
": bytes: %d-"
,
&
offset
))
{
/* This second format was added August 1st by Igor
/* This second format was added August 1st
2000
by Igor
Khristophorov since Sun's webserver JavaWebServer/1.1.1
obviously sends the header this way! :-( */
if
(
data
->
resume_from
==
offset
)
{
...
...
@@ -457,9 +469,14 @@ _Transfer(struct connectdata *c_conn)
is non-headers. */
if
(
str
&&
!
header
&&
((
signed
int
)
nread
>
0
))
{
/*
* If we requested a HTTP header, this might be a good time to get
* out and return home.
*/
if
(
0
==
bodywrites
)
{
/* These checks are only made the first time we are about to
write a
chunk
of the body */
write a
piece
of the body */
if
(
conn
->
protocol
&
PROT_HTTP
)
{
/* HTTP-only checks */
if
(
data
->
newurl
)
{
...
...
@@ -516,6 +533,13 @@ _Transfer(struct connectdata *c_conn)
}
/* this is the first time we write a body part */
bodywrites
++
;
if
(
conn
->
bits
.
chunk
)
{
/*
* Bless me father for I have sinned. Here come a chunked
* transfer flighing and we need to decode this properly.
*/
}
if
(
conn
->
maxdownload
&&
(
bytecount
+
nread
>=
conn
->
maxdownload
))
{
nread
=
conn
->
maxdownload
-
bytecount
;
...
...
This diff is collapsed.
Click to expand it.
lib/urldata.h
+
1
−
0
View file @
91e4da7d
...
...
@@ -196,6 +196,7 @@ struct FILE {
struct
ConnectBits
{
bool
close
;
/* if set, we close the connection after this request */
bool
reuse
;
/* if set, this is a re-used connection */
bool
chunk
;
/* if set, this is a chunked transfer-encoding */
};
/*
...
...
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