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
3685f792
Commit
3685f792
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
ignore SIGPIPE, as that can be actually get sent when we write to a socket
parent
e227a276
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/url.c
+62
-57
62 additions, 57 deletions
lib/url.c
with
62 additions
and
57 deletions
lib/url.c
+
62
−
57
View file @
3685f792
...
...
@@ -206,84 +206,89 @@ CURLcode Curl_open(struct SessionHandle **curl)
/* Very simple start-up: alloc the struct, init it with zeroes and return */
data
=
(
struct
SessionHandle
*
)
malloc
(
sizeof
(
struct
SessionHandle
));
if
(
data
)
{
memset
(
data
,
0
,
sizeof
(
struct
SessionHandle
));
/* We do some initial setup here, all those fields that can't be just 0 */
data
->
state
.
headerbuff
=
(
char
*
)
malloc
(
HEADERSIZE
);
if
(
!
data
->
state
.
headerbuff
)
{
free
(
data
);
/* free the memory again */
return
CURLE_OUT_OF_MEMORY
;
}
data
->
state
.
headersize
=
HEADERSIZE
;
data
->
set
.
out
=
stdout
;
/* default output to stdout */
data
->
set
.
in
=
stdin
;
/* default input from stdin */
data
->
set
.
err
=
stderr
;
/* default stderr to stderr */
if
(
!
data
)
/* this is a very serious error */
return
CURLE_OUT_OF_MEMORY
;
memset
(
data
,
0
,
sizeof
(
struct
SessionHandle
));
/* use fwrite as default function to store output */
data
->
set
.
fwrite
=
(
curl_write_callback
)
fwrite
;
/* We do some initial setup here, all those fields that can't be just 0 */
/* use fread as default function to read input */
data
->
set
.
fread
=
(
curl_read_callback
)
fread
;
data
->
state
.
headerbuff
=
(
char
*
)
malloc
(
HEADERSIZE
);
if
(
!
data
->
state
.
headerbuff
)
{
free
(
data
);
/* free the memory again */
return
CURLE_OUT_OF_MEMORY
;
}
/* set the default passwd function */
data
->
set
.
fpasswd
=
my_getpass
;
data
->
state
.
headersize
=
HEADERSIZE
;
data
->
set
.
infilesize
=
-
1
;
/* we don't know any size */
data
->
set
.
out
=
stdout
;
/* default output to stdout */
data
->
set
.
in
=
stdin
;
/* default input from stdin */
data
->
set
.
err
=
stderr
;
/* default stderr to stderr */
/* use fwrite as default function to store output */
data
->
set
.
fwrite
=
(
curl_write_callback
)
fwrite
;
data
->
state
.
current_speed
=
-
1
;
/* init to negative == impossible */
/* use fread as default function to read input */
data
->
set
.
fread
=
(
curl_read_callback
)
fread
;
/* set the default passwd function */
data
->
set
.
fpasswd
=
my_getpass
;
data
->
set
.
httpreq
=
HTTPREQ_GET
;
/* Default HTTP request
*/
data
->
set
.
infilesize
=
-
1
;
/* we don't know any size
*/
/* make libcurl quiet by default: */
data
->
set
.
hide_progress
=
TRUE
;
/* CURLOPT_NOPROGRESS changes these */
data
->
progress
.
flags
|=
PGRS_HIDE
;
data
->
state
.
current_speed
=
-
1
;
/* init to negative == impossible */
/* Set the default size of the SSL session ID cache */
data
->
set
.
ssl
.
numsessions
=
5
;
data
->
set
.
httpreq
=
HTTPREQ_GET
;
/* Default HTTP request */
/* create an array with connection data struct pointers */
data
->
state
.
numconnects
=
5
;
/* hard-coded right now */
data
->
state
.
connects
=
(
struct
connectdata
**
)
malloc
(
sizeof
(
struct
connectdata
*
)
*
data
->
state
.
numconnects
);
/* make libcurl quiet by default: */
data
->
set
.
hide_progress
=
TRUE
;
/* CURLOPT_NOPROGRESS changes these */
data
->
progress
.
flags
|=
PGRS_HIDE
;
if
(
!
data
->
state
.
connects
)
{
free
(
data
);
return
CURLE_OUT_OF_MEMORY
;
}
/* Set the default size of the SSL session ID cache */
data
->
set
.
ssl
.
numsessions
=
5
;
memset
(
data
->
state
.
connects
,
0
,
sizeof
(
struct
connectdata
*
)
*
data
->
state
.
numconnects
);
/* create an array with connection data struct pointers */
data
->
state
.
numconnects
=
5
;
/* hard-coded right now */
data
->
state
.
connects
=
(
struct
connectdata
**
)
malloc
(
sizeof
(
struct
connectdata
*
)
*
data
->
state
.
numconnects
);
if
(
!
data
->
state
.
connects
)
{
free
(
data
);
return
CURLE_OUT_OF_MEMORY
;
}
memset
(
data
->
state
.
connects
,
0
,
sizeof
(
struct
connectdata
*
)
*
data
->
state
.
numconnects
);
*
curl
=
data
;
*
curl
=
data
;
/*************************************************************
* Set signal handler
*************************************************************/
/*************************************************************
* Set signal handler
to catch SIGALRM
*************************************************************/
#ifdef HAVE_SIGACTION
sigaction
(
SIGALRM
,
NULL
,
&
sigact
);
sigact
.
sa_handler
=
alarmfunc
;
sigaction
(
SIGALRM
,
NULL
,
&
sigact
);
sigact
.
sa_handler
=
alarmfunc
;
#ifdef SA_RESTART
/* HPUX doesn't have SA_RESTART but defaults to that behaviour! */
sigact
.
sa_flags
&=
~
SA_RESTART
;
/* HPUX doesn't have SA_RESTART but defaults to that behaviour! */
sigact
.
sa_flags
&=
~
SA_RESTART
;
#endif
sigaction
(
SIGALRM
,
&
sigact
,
NULL
);
sigaction
(
SIGALRM
,
&
sigact
,
NULL
);
#else
/* no sigaction(), revert to the much lamer signal() */
/* no sigaction(), revert to the much lamer signal() */
#ifdef HAVE_SIGNAL
signal
(
SIGALRM
,
alarmfunc
);
signal
(
SIGALRM
,
alarmfunc
);
#endif
#endif
return
CURLE_OK
;
}
/* this is a very serious error */
return
CURLE_OUT_OF_MEMORY
;
/*************************************************************
* Tell signal handler to ignore SIGPIPE
*************************************************************/
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
(
void
)
signal
(
SIGPIPE
,
SIG_IGN
);
#endif
return
CURLE_OK
;
}
CURLcode
Curl_setopt
(
struct
SessionHandle
*
data
,
CURLoption
option
,
...)
...
...
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