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
f0bb9c7d
Commit
f0bb9c7d
authored
16 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
added an extra set of braces to unconfuse emacs and then I re-indented a
section of the code that was odd-looking previously
parent
d4514f9c
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
+108
-108
108 additions, 108 deletions
lib/http.c
with
108 additions
and
108 deletions
lib/http.c
+
108
−
108
View file @
f0bb9c7d
...
...
@@ -2777,133 +2777,133 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if
(
conn
->
bits
.
authneg
)
postsize
=
0
;
else
else
{
/* figure out the size of the postfields */
postsize
=
(
data
->
set
.
postfieldsize
!=
-
1
)
?
data
->
set
.
postfieldsize
:
(
data
->
set
.
postfields
?
(
curl_off_t
)
strlen
(
data
->
set
.
postfields
)
:
0
);
}
if
(
!
data
->
req
.
upload_chunky
)
{
/* We only set Content-Length and allow a custom Content-Length if
we don't upload data chunked, as RFC2616 forbids us to set both
kinds of headers (Transfer-Encoding: chunked and Content-Length) */
if
(
!
checkheaders
(
data
,
"Content-Length:"
))
{
/* we allow replacing this header, although it isn't very wise to
actually set your own */
result
=
add_bufferf
(
req_buffer
,
"Content-Length: %"
FORMAT_OFF_T
"
\r\n
"
,
postsize
);
if
(
result
)
return
result
;
}
}
if
(
!
data
->
req
.
upload_chunky
)
{
/* We only set Content-Length and allow a custom Content-Length if
we don't upload data chunked, as RFC2616 forbids us to set both
kinds of headers (Transfer-Encoding: chunked and Content-Length) */
if
(
!
checkheaders
(
data
,
"Content-Length:"
))
{
/* we allow replacing this header, although it isn't very wise to
actually set your own */
result
=
add_bufferf
(
req_buffer
,
"Content-Length: %"
FORMAT_OFF_T
"
\r\n
"
,
postsize
);
if
(
result
)
return
result
;
}
}
if
(
!
checkheaders
(
data
,
"Content-Type:"
))
{
result
=
add_bufferf
(
req_buffer
,
"Content-Type: application/x-www-form-urlencoded
\r\n
"
);
if
(
result
)
return
result
;
}
if
(
!
checkheaders
(
data
,
"Content-Type:"
))
{
result
=
add_bufferf
(
req_buffer
,
"Content-Type: application/x-www-form-urlencoded
\r\n
"
);
if
(
result
)
return
result
;
}
/* For really small posts we don't use Expect: headers at all, and for
the somewhat bigger ones we allow the app to disable it. Just make
sure that the expect100header is always set to the preferred value
here. */
if
(
postsize
>
TINY_INITIAL_POST_SIZE
)
{
result
=
expect100
(
data
,
conn
,
req_buffer
);
if
(
result
)
return
result
;
}
else
data
->
state
.
expect100header
=
FALSE
;
/* For really small posts we don't use Expect: headers at all, and for
the somewhat bigger ones we allow the app to disable it. Just make
sure that the expect100header is always set to the preferred value
here. */
if
(
postsize
>
TINY_INITIAL_POST_SIZE
)
{
result
=
expect100
(
data
,
conn
,
req_buffer
);
if
(
result
)
return
result
;
}
else
data
->
state
.
expect100header
=
FALSE
;
if
(
data
->
set
.
postfields
)
{
if
(
data
->
set
.
postfields
)
{
if
(
!
data
->
state
.
expect100header
&&
(
postsize
<
MAX_INITIAL_POST_SIZE
))
{
/* if we don't use expect: 100 AND
postsize is less than MAX_INITIAL_POST_SIZE
if
(
!
data
->
state
.
expect100header
&&
(
postsize
<
MAX_INITIAL_POST_SIZE
))
{
/* if we don't use expect: 100 AND
postsize is less than MAX_INITIAL_POST_SIZE
then append the post data to the HTTP request header. This limit
is no magic limit but only set to prevent really huge POSTs to
get the data duplicated with malloc() and family. */
then append the post data to the HTTP request header. This limit
is no magic limit but only set to prevent really huge POSTs to
get the data duplicated with malloc() and family. */
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
if
(
!
data
->
req
.
upload_chunky
)
{
/* We're not sending it 'chunked', append it to the request
already now to reduce the number if send() calls */
result
=
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
(
size_t
)
postsize
);
included_body
=
postsize
;
}
else
{
/* Append the POST data chunky-style */
result
=
add_bufferf
(
req_buffer
,
"%x
\r\n
"
,
(
int
)
postsize
);
if
(
CURLE_OK
==
result
)
result
=
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
(
size_t
)
postsize
);
if
(
CURLE_OK
==
result
)
result
=
add_buffer
(
req_buffer
,
"
\x0d\x0a\x30\x0d\x0a\x0d\x0a
"
,
7
);
/* CR LF 0 CR LF CR LF */
included_body
=
postsize
+
7
;
}
if
(
result
)
return
result
;
}
else
{
/* A huge POST coming up, do data separate from the request */
http
->
postsize
=
postsize
;
http
->
postdata
=
data
->
set
.
postfields
;
if
(
!
data
->
req
.
upload_chunky
)
{
/* We're not sending it 'chunked', append it to the request
already now to reduce the number if send() calls */
result
=
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
(
size_t
)
postsize
);
included_body
=
postsize
;
}
else
{
/* Append the POST data chunky-style */
result
=
add_bufferf
(
req_buffer
,
"%x
\r\n
"
,
(
int
)
postsize
);
if
(
CURLE_OK
==
result
)
result
=
add_buffer
(
req_buffer
,
data
->
set
.
postfields
,
(
size_t
)
postsize
);
if
(
CURLE_OK
==
result
)
result
=
add_buffer
(
req_buffer
,
"
\x0d\x0a\x30\x0d\x0a\x0d\x0a
"
,
7
);
/* CR LF 0 CR LF CR LF */
included_body
=
postsize
+
7
;
}
if
(
result
)
return
result
;
}
else
{
/* A huge POST coming up, do data separate from the request */
http
->
postsize
=
postsize
;
http
->
postdata
=
data
->
set
.
postfields
;
http
->
sending
=
HTTPSEND_BODY
;
http
->
sending
=
HTTPSEND_BODY
;
conn
->
fread_func
=
(
curl_read_callback
)
readmoredata
;
conn
->
fread_in
=
(
void
*
)
conn
;
conn
->
fread_func
=
(
curl_read_callback
)
readmoredata
;
conn
->
fread_in
=
(
void
*
)
conn
;
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize
(
data
,
http
->
postsize
);
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize
(
data
,
http
->
postsize
);
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
}
}
else
{
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
}
}
else
{
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
/* end of headers! */
if
(
result
)
return
result
;
if
(
data
->
set
.
postfieldsize
)
{
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize
(
data
,
postsize
?
postsize
:-
1
);
if
(
data
->
set
.
postfieldsize
)
{
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize
(
data
,
postsize
?
postsize
:-
1
);
/* set the pointer to mark that we will send the post body using the
read callback, but only if we're not in authenticate
negotiation */
if
(
!
conn
->
bits
.
authneg
)
{
http
->
postdata
=
(
char
*
)
&
http
->
postdata
;
http
->
postsize
=
postsize
;
}
}
/* set the pointer to mark that we will send the post body using the
read callback, but only if we're not in authenticate
negotiation */
if
(
!
conn
->
bits
.
authneg
)
{
http
->
postdata
=
(
char
*
)
&
http
->
postdata
;
http
->
postsize
=
postsize
;
}
/* issue the request */
result
=
add_buffer_send
(
req_buffer
,
conn
,
&
data
->
info
.
request_size
,
(
size_t
)
included_body
,
FIRSTSOCKET
);
}
}
/* issue the request */
result
=
add_buffer_send
(
req_buffer
,
conn
,
&
data
->
info
.
request_size
,
(
size_t
)
included_body
,
FIRSTSOCKET
);
if
(
result
)
failf
(
data
,
"Failed sending HTTP POST request"
);
else
result
=
Curl_setup_transfer
(
conn
,
FIRSTSOCKET
,
-
1
,
TRUE
,
&
http
->
readbytecount
,
http
->
postdata
?
FIRSTSOCKET
:-
1
,
http
->
postdata
?&
http
->
writebytecount
:
NULL
);
break
;
if
(
result
)
failf
(
data
,
"Failed sending HTTP POST request"
);
else
result
=
Curl_setup_transfer
(
conn
,
FIRSTSOCKET
,
-
1
,
TRUE
,
&
http
->
readbytecount
,
http
->
postdata
?
FIRSTSOCKET
:-
1
,
http
->
postdata
?&
http
->
writebytecount
:
NULL
);
break
;
default:
result
=
add_buffer
(
req_buffer
,
"
\r\n
"
,
2
);
...
...
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