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
0b5901be
Commit
0b5901be
authored
14 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
easy: fix compiler warning: end-of-loop code not reached
parent
5965d455
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/easy.c
+79
-85
79 additions, 85 deletions
lib/easy.c
with
79 additions
and
85 deletions
lib/easy.c
+
79
−
85
View file @
0b5901be
...
...
@@ -626,123 +626,117 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
*/
CURL
*
curl_easy_duphandle
(
CURL
*
incurl
)
{
bool
fail
=
TRUE
;
struct
SessionHandle
*
data
=
(
struct
SessionHandle
*
)
incurl
;
struct
SessionHandle
*
outcurl
=
calloc
(
1
,
sizeof
(
struct
SessionHandle
));
if
(
NULL
==
outcurl
)
return
NULL
;
/* failure */
for
(;;)
{
goto
fail
;
/*
* We setup a few buffers we need. We should probably make them
* get setup on-demand in the code, as that would probably decrease
* the likeliness of us forgetting to init a buffer here in the future.
*/
outcurl
->
state
.
headerbuff
=
malloc
(
HEADERSIZE
);
if
(
!
outcurl
->
state
.
headerbuff
)
break
;
outcurl
->
state
.
headersize
=
HEADERSIZE
;
/*
* We setup a few buffers we need. We should probably make them
* get setup on-demand in the code, as that would probably decrease
* the likeliness of us forgetting to init a buffer here in the future.
*/
outcurl
->
state
.
headerbuff
=
malloc
(
HEADERSIZE
);
if
(
!
outcurl
->
state
.
headerbuff
)
goto
fail
;
outcurl
->
state
.
headersize
=
HEADERSIZE
;
/* copy all userdefined values */
if
(
Curl_dupset
(
outcurl
,
data
)
!=
CURLE_OK
)
break
;
/* copy all userdefined values */
if
(
Curl_dupset
(
outcurl
,
data
)
!=
CURLE_OK
)
goto
fail
;
/* the connection cache is setup on demand */
outcurl
->
state
.
connc
=
NULL
;
/* the connection cache is setup on demand */
outcurl
->
state
.
connc
=
NULL
;
outcurl
->
state
.
lastconnect
=
-
1
;
outcurl
->
state
.
lastconnect
=
-
1
;
outcurl
->
progress
.
flags
=
data
->
progress
.
flags
;
outcurl
->
progress
.
callback
=
data
->
progress
.
callback
;
outcurl
->
progress
.
flags
=
data
->
progress
.
flags
;
outcurl
->
progress
.
callback
=
data
->
progress
.
callback
;
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
if
(
data
->
cookies
)
{
/* If cookies are enabled in the parent handle, we enable them
in the clone as well! */
outcurl
->
cookies
=
Curl_cookie_init
(
data
,
data
->
cookies
->
filename
,
outcurl
->
cookies
,
data
->
set
.
cookiesession
);
if
(
!
outcurl
->
cookies
)
break
;
}
if
(
data
->
cookies
)
{
/* If cookies are enabled in the parent handle, we enable them
in the clone as well! */
outcurl
->
cookies
=
Curl_cookie_init
(
data
,
data
->
cookies
->
filename
,
outcurl
->
cookies
,
data
->
set
.
cookiesession
);
if
(
!
outcurl
->
cookies
)
goto
fail
;
}
#endif
/* CURL_DISABLE_HTTP */
/* duplicate all values in 'change' */
/* duplicate all values in 'change' */
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
if
(
data
->
change
.
cookielist
)
{
outcurl
->
change
.
cookielist
=
Curl_slist_duplicate
(
data
->
change
.
cookielist
);
if
(
!
outcurl
->
change
.
cookielist
)
break
;
}
if
(
data
->
change
.
cookielist
)
{
outcurl
->
change
.
cookielist
=
Curl_slist_duplicate
(
data
->
change
.
cookielist
);
if
(
!
outcurl
->
change
.
cookielist
)
goto
fail
;
}
#endif
/* CURL_DISABLE_HTTP */
if
(
data
->
change
.
url
)
{
outcurl
->
change
.
url
=
strdup
(
data
->
change
.
url
);
if
(
!
outcurl
->
change
.
url
)
break
;
outcurl
->
change
.
url_alloc
=
TRUE
;
}
if
(
data
->
change
.
url
)
{
outcurl
->
change
.
url
=
strdup
(
data
->
change
.
url
);
if
(
!
outcurl
->
change
.
url
)
goto
fail
;
outcurl
->
change
.
url_alloc
=
TRUE
;
}
if
(
data
->
change
.
referer
)
{
outcurl
->
change
.
referer
=
strdup
(
data
->
change
.
referer
);
if
(
!
outcurl
->
change
.
referer
)
break
;
outcurl
->
change
.
referer_alloc
=
TRUE
;
}
if
(
data
->
change
.
referer
)
{
outcurl
->
change
.
referer
=
strdup
(
data
->
change
.
referer
);
if
(
!
outcurl
->
change
.
referer
)
goto
fail
;
outcurl
->
change
.
referer_alloc
=
TRUE
;
}
#ifdef USE_ARES
/* If we use ares, we clone the ares channel for the new handle */
if
(
ARES_SUCCESS
!=
ares_dup
(
&
outcurl
->
state
.
areschannel
,
data
->
state
.
areschannel
))
break
;
/* If we use ares, we clone the ares channel for the new handle */
if
(
ARES_SUCCESS
!=
ares_dup
(
&
outcurl
->
state
.
areschannel
,
data
->
state
.
areschannel
))
goto
fail
;
#endif
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
outcurl
->
inbound_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_HOST
,
CURL_ICONV_CODESET_OF_NETWORK
);
outcurl
->
outbound_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_NETWORK
,
CURL_ICONV_CODESET_OF_HOST
);
outcurl
->
utf8_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_HOST
,
CURL_ICONV_CODESET_FOR_UTF8
);
outcurl
->
inbound_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_HOST
,
CURL_ICONV_CODESET_OF_NETWORK
);
outcurl
->
outbound_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_NETWORK
,
CURL_ICONV_CODESET_OF_HOST
);
outcurl
->
utf8_cd
=
iconv_open
(
CURL_ICONV_CODESET_OF_HOST
,
CURL_ICONV_CODESET_FOR_UTF8
);
#endif
Curl_easy_initHandleData
(
outcurl
);
Curl_easy_initHandleData
(
outcurl
);
outcurl
->
magic
=
CURLEASY_MAGIC_NUMBER
;
outcurl
->
magic
=
CURLEASY_MAGIC_NUMBER
;
fail
=
FALSE
;
/* we reach this point and thus we are OK */
break
;
}
/* we reach this point and thus we are OK */
return
outcurl
;
if
(
fail
)
{
if
(
outcurl
)
{
if
(
outcurl
->
state
.
connc
&&
(
outcurl
->
state
.
connc
->
type
==
CONNCACHE_PRIVATE
))
Curl_rm_connc
(
outcurl
->
state
.
connc
);
if
(
outcurl
->
state
.
headerbuff
)
free
(
outcurl
->
state
.
headerbuff
);
fail:
if
(
outcurl
)
{
if
(
outcurl
->
state
.
connc
&&
(
outcurl
->
state
.
connc
->
type
==
CONNCACHE_PRIVATE
))
Curl_rm_connc
(
outcurl
->
state
.
connc
);
if
(
outcurl
->
state
.
headerbuff
)
free
(
outcurl
->
state
.
headerbuff
);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
if
(
outcurl
->
change
.
cookielist
)
curl_slist_free_all
(
outcurl
->
change
.
cookielist
);
if
(
outcurl
->
change
.
cookielist
)
curl_slist_free_all
(
outcurl
->
change
.
cookielist
);
#endif
if
(
outcurl
->
change
.
url
)
free
(
outcurl
->
change
.
url
);
if
(
outcurl
->
change
.
referer
)
free
(
outcurl
->
change
.
referer
);
Curl_freeset
(
outcurl
);
free
(
outcurl
);
/* free the memory again */
outcurl
=
NULL
;
}
if
(
outcurl
->
change
.
url
)
free
(
outcurl
->
change
.
url
);
if
(
outcurl
->
change
.
referer
)
free
(
outcurl
->
change
.
referer
);
Curl_freeset
(
outcurl
);
free
(
outcurl
);
}
return
outcurl
;
return
NULL
;
}
/*
...
...
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