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
468b7872
Commit
468b7872
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
if CURLOPT_POSTFIELDS isn't set, but CURLOPT_POST is, we will assume that
we should read the POST-data from the read callback
parent
cfdb6f85
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
+45
-43
45 additions, 43 deletions
lib/http.c
with
45 additions
and
43 deletions
lib/http.c
+
45
−
43
View file @
468b7872
...
...
@@ -814,7 +814,9 @@ CURLcode Curl_http(struct connectdata *conn)
headers
=
headers
->
next
;
}
if
(
HTTPREQ_POST_FORM
==
data
->
set
.
httpreq
)
{
switch
(
data
->
set
.
httpreq
)
{
case
HTTPREQ_POST_FORM
:
if
(
Curl_FormInit
(
&
http
->
form
,
http
->
sendit
))
{
failf
(
data
,
"Internal HTTP POST error!"
);
return
CURLE_HTTP_POST_ERROR
;
...
...
@@ -883,9 +885,9 @@ CURLcode Curl_http(struct connectdata *conn)
Curl_formclean
(
http
->
sendit
);
/* free that whole lot */
return
result
;
}
}
else
if
(
HTTPREQ_PUT
==
data
->
set
.
httpreq
)
{
/* Let's PUT the data to the server! */
break
;
case
HTTPREQ_PUT
:
/* Let's PUT the data to the server! */
if
(
data
->
set
.
infilesize
>
0
)
{
add_bufferf
(
req_buffer
,
...
...
@@ -911,51 +913,51 @@ CURLcode Curl_http(struct connectdata *conn)
&
http
->
writebytecount
);
if
(
result
)
return
result
;
}
else
{
if
(
HTTPREQ_POST
==
data
->
set
.
httpreq
)
{
/* this is the simple POST, using x-www-form-urlencoded style */
if
(
!
data
->
set
.
postfields
)
{
/*
* This is an attempt to do a POST without having anything to
* actually send. Let's make a NULL pointer equal "" here. Good/bad
* ?
*/
data
->
set
.
postfields
=
(
char
*
)
""
;
data
->
set
.
postfieldsize
=
0
;
/* it might been set to something illegal,
anything > 0 would be! */
}
break
;
if
(
!
checkheaders
(
data
,
"Content-Length:"
))
/* we allow replacing this header, although it isn't very wise to
actually set your own */
add_bufferf
(
req_buffer
,
"Content-Length: %d
\r\n
"
,
(
data
->
set
.
postfieldsize
?
data
->
set
.
postfieldsize
:
strlen
(
data
->
set
.
postfields
))
);
case
HTTPREQ_POST
:
/* this is the simple POST, using x-www-form-urlencoded style */
if
(
!
checkheaders
(
data
,
"Content-Type:"
))
add_bufferf
(
req_buffer
,
"Content-Type: application/x-www-form-urlencoded
\r\n
"
);
if
(
!
checkheaders
(
data
,
"Content-Length:"
))
/* we allow replacing this header, although it isn't very wise to
actually set your own */
add_bufferf
(
req_buffer
,
"Content-Length: %d
\r\n
"
,
(
data
->
set
.
postfieldsize
?
data
->
set
.
postfieldsize
:
strlen
(
data
->
set
.
postfields
))
);
/* and here comes the actual data */
if
(
data
->
set
.
postfieldsize
)
{
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
data
->
set
.
postfieldsize
);
}
else
{
add_bufferf
(
req_buffer
,
"
\r\n
"
"%s"
,
data
->
set
.
postfields
);
}
if
(
!
checkheaders
(
data
,
"Content-Type:"
))
add_bufferf
(
req_buffer
,
"Content-Type: application/x-www-form-urlencoded
\r\n
"
);
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* and here comes the actual data */
if
(
data
->
set
.
postfieldsize
&&
data
->
set
.
postfields
)
{
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
data
->
set
.
postfieldsize
);
}
else
if
(
data
->
set
.
postfields
)
add_bufferf
(
req_buffer
,
"%s"
,
data
->
set
.
postfields
);
/* issue the request */
result
=
add_buffer_send
(
conn
->
firstsocket
,
conn
,
req_buffer
,
&
data
->
info
.
request_size
);
if
(
result
)
failf
(
data
,
"Failed sending HTTP POST request"
);
else
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
result
=
Curl_Transfer
(
conn
,
conn
->
firstsocket
,
-
1
,
TRUE
,
bytecount
,
data
->
set
.
postfields
?-
1
:
conn
->
firstsocket
,
data
->
set
.
postfields
?
NULL
:&
http
->
writebytecount
);
break
;
default:
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* issue the request */
result
=
add_buffer_send
(
conn
->
firstsocket
,
conn
,
req_buffer
,
&
data
->
info
.
request_size
);
...
...
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