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
7247041e
Commit
7247041e
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Improved checks for bad memory situations and proper behaviour when we
run out of memory.
parent
017a78d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/http.c
+33
-17
33 additions, 17 deletions
lib/http.c
with
33 additions
and
17 deletions
lib/http.c
+
33
−
17
View file @
7247041e
...
...
@@ -591,7 +591,6 @@ CURLcode add_buffer_send(send_buffer *in,
static
CURLcode
add_bufferf
(
send_buffer
*
in
,
const
char
*
fmt
,
...)
{
CURLcode
result
=
CURLE_OUT_OF_MEMORY
;
char
*
s
;
va_list
ap
;
va_start
(
ap
,
fmt
);
...
...
@@ -599,10 +598,16 @@ CURLcode add_bufferf(send_buffer *in, const char *fmt, ...)
va_end
(
ap
);
if
(
s
)
{
result
=
add_buffer
(
in
,
s
,
strlen
(
s
));
CURLcode
result
=
add_buffer
(
in
,
s
,
strlen
(
s
));
free
(
s
);
if
(
CURLE_OK
==
result
)
return
CURLE_OK
;
}
return
result
;
/* If we failed, we cleanup the whole buffer and return error */
if
(
in
->
buffer
)
free
(
in
->
buffer
);
free
(
in
);
return
CURLE_OUT_OF_MEMORY
;
}
/*
...
...
@@ -1152,6 +1157,10 @@ CURLcode Curl_http(struct connectdata *conn)
host
,
conn
->
bits
.
ipv6_ip
?
"]"
:
""
,
conn
->
remote_port
);
if
(
!
conn
->
allocptr
.
host
)
/* without Host: we can't make a nice request */
return
CURLE_OUT_OF_MEMORY
;
}
if
(
data
->
cookies
)
{
...
...
@@ -1290,21 +1299,25 @@ CURLcode Curl_http(struct connectdata *conn)
/* initialize a dynamic send-buffer */
req_buffer
=
add_buffer_init
();
if
(
!
req_buffer
)
return
CURLE_OUT_OF_MEMORY
;
/* add the main request stuff */
add_bufferf
(
req_buffer
,
"%s "
/* GET/HEAD/POST/PUT */
"%s HTTP/%s
\r\n
"
/* path + HTTP version */
"%s"
/* proxyuserpwd */
"%s"
/* userpwd */
"%s"
/* range */
"%s"
/* user agent */
"%s"
/* cookie */
"%s"
/* host */
"%s"
/* pragma */
"%s"
/* accept */
"%s"
/* accept-encoding */
"%s"
/* referer */
"%s"
,
/* transfer-encoding */
result
=
add_bufferf
(
req_buffer
,
"%s "
/* GET/HEAD/POST/PUT */
"%s HTTP/%s
\r\n
"
/* path + HTTP version */
"%s"
/* proxyuserpwd */
"%s"
/* userpwd */
"%s"
/* range */
"%s"
/* user agent */
"%s"
/* cookie */
"%s"
/* host */
"%s"
/* pragma */
"%s"
/* accept */
"%s"
/* accept-encoding */
"%s"
/* referer */
"%s"
,
/* transfer-encoding */
request
,
ppath
,
...
...
@@ -1326,6 +1339,9 @@ CURLcode Curl_http(struct connectdata *conn)
te
);
if
(
result
)
return
result
;
if
(
co
)
{
int
count
=
0
;
struct
Cookie
*
store
=
co
;
...
...
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