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
ecfede9b
Commit
ecfede9b
authored
17 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Alessandro Vesely helped me improve the --data-urlencode's syntax, parser
and documentation.
parent
cb04619d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGES
+4
-0
4 additions, 0 deletions
CHANGES
RELEASE-NOTES
+1
-1
1 addition, 1 deletion
RELEASE-NOTES
docs/curl.1
+41
-35
41 additions, 35 deletions
docs/curl.1
src/main.c
+15
-11
15 additions, 11 deletions
src/main.c
with
61 additions
and
47 deletions
CHANGES
+
4
−
0
View file @
ecfede9b
...
...
@@ -7,6 +7,10 @@
Changelog
Daniel S (22 Nov 2007)
- Alessandro Vesely helped me improve the --data-urlencode's syntax, parser
and documentation.
Daniel S (21 Nov 2007)
- While inspecting the Negotiate code, I noticed how the proxy auth was using
the same state struct as the host auth, so both could never be used at the
...
...
This diff is collapsed.
Click to expand it.
RELEASE-NOTES
+
1
−
1
View file @
ecfede9b
...
...
@@ -45,6 +45,6 @@ advice from friends like these:
Dan Fandrich, Gisle Vanem, Toby Peterson, Yang Tse, Daniel Black,
Robin Johnson, Michal Marek, Ates Goral, Andres Garcia, Rob Crittenden,
Emil Romanus
Emil Romanus
, Alessandro Vesely
Thanks! (and sorry if I forgot to mention someone)
This diff is collapsed.
Click to expand it.
docs/curl.1
+
41
−
35
View file @
ecfede9b
...
...
@@ -224,56 +224,62 @@ To create remote directories when using FTP or SFTP, try
If this option is used several times, the following occurrences make no
difference.
.IP "-d/--data <data>"
(HTTP) Sends the specified data in a POST request to the HTTP server, in a way
that can emulate as if a user has filled in a HTML form and pressed the submit
button. Note that the data is sent exactly as specified with no extra
processing (with all newlines cut off). The data is expected to be
\&"url-encoded". This will cause curl to pass the data to the server using the
content-type application/x-www-form-urlencoded. Compare to \fI-F/--form\fP. If
this option is used more than once on the same command line, the data pieces
specified will be merged together with a separating &-letter. Thus, using '-d
name=daniel -d skill=lousy' would generate a post chunk that looks like
\&'name=daniel&skill=lousy'.
(HTTP) Sends the specified data in a POST request to the HTTP server, in the
same way that a browser does when a user has filled in an HTML form and
presses the submit button. This will cause curl to pass the data to the server
using the content-type application/x-www-form-urlencoded. Compare to
\fI-F/--form\fP.
\fI-d/--data\fP is the same as \fI--data-ascii\fP. To post data purely binary,
you should instead use the \fI--data-binary\fP option. To URL encode the value
of a form field you may use \fI--data-urlencode\fP.
If any of these options is used more than once on the same command line, the
data pieces specified will be merged together with a separating
&-letter. Thus, using '-d name=daniel -d skill=lousy' would generate a post
chunk that looks like \&'name=daniel&skill=lousy'.
If you start the data with the letter @, the rest should be a file name to
read the data from, or - if you want curl to read the data from stdin. The
contents of the file must already be url-encoded. Multiple files can also be
specified. Posting data from a file named 'foobar' would thus be done with
\fI--data\fP @foobar".
To post data purely binary, you should instead use the \fI--data-binary\fP
option.
\fI-d/--data\fP is the same as \fI--data-ascii\fP.
If this option is used several times, the ones following the first will
append data.
.IP "--data-ascii <data>"
(HTTP) This is an alias for the \fI-d/--data\fP option.
If this option is used several times, the ones following the first will
append data.
\fI--data @foobar\fP.
.IP "--data-binary <data>"
(HTTP) This posts data in a similar manner as \fI--data-ascii\fP does,
although when using this option the entire context of the posted data is kept
as-is. If you want to post a binary file without the strip-newlines feature of
the \fI--data-ascii\fP option, this is for you.
(HTTP) This posts data exactly as specified with no extra processing
whatsoever.
If you start the data with the letter @, the rest should be a filename. Data
is posted in a similar manner as \fI--data-ascii\fP does, except that newlines
are preserved and conversions are never done.
If this option is used several times, the ones following the first will
append
data.
If this option is used several times, the ones following the first will
append
data. As described in \fI-d/--
data
\fP
.
.IP "--data-urlencode <data>"
(HTTP) This posts data, similar to the other --data options with the exception
that this
will do partial
URL encoding. (Added in 7.17.2)
that this
performs
URL encoding. (Added in 7.17.2)
The <data> part should be using one of the two following syntaxes:
To be CGI compliant, the <data> part should begin with a \fIname\fP followed
by a separator and a content specification. The <data> part can be passed to
curl using one of the following syntaxes:
.RS
.IP "content"
This will make curl URL encode the content and pass that on. Just be careful
so that the content doesn't contain any = or @ letters, as that will then make
the syntax match one of the other cases below!
.IP "=content"
This will make curl URL encode the content and pass that on. The preceding =
letter is not included in the data.
.IP "name=content"
This will make curl URL encode the content part and pass that on. Note that
the name part is expected to be URL encoded already.
.IP "@filename"
This will make curl load data from the given file (including any newlines),
URL encode that data and pass it on in the POST.
.IP "name@filename"
This will make curl load data from the given file, URL encode that data and
pass it on in the POST like \fIname=urlencoded-data\fP. Note that the name
is expected to be URL encoded already.
This will make curl load data from the given file (including any newlines),
URL encode that data and pass it on in the POST. The name part gets an equal
sign appended, resulting in \fIname=urlencoded-file-content\fP. Note that the
name is expected to be URL encoded already.
.RE
.IP "--digest"
(HTTP) Enables HTTP Digest authentication. This is a authentication that
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
15
−
11
View file @
ecfede9b
...
...
@@ -2059,19 +2059,21 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
*/
char
*
p
=
strchr
(
nextarg
,
'='
);
long
size
=
0
;
size_t
nlen
;
int
nlen
;
char
is_file
;
if
(
!
p
)
p
=
strchr
(
nextarg
,
'@'
);
if
(
!
p
)
{
warnf
(
config
,
"bad use of --data-urlencode
\n
"
);
return
PARAM_BAD_USE
;
if
(
p
)
{
nlen
=
p
-
nextarg
;
/* length of the name part */
is_file
=
*
p
++
;
/* pass the separator */
}
else
{
nlen
=
is_file
=
-
1
;
p
=
nextarg
;
}
nlen
=
p
-
nextarg
;
/* length of the name part */
if
(
'@'
==
*
p
)
{
if
(
'@'
==
is_file
)
{
/* a '@' letter, it means that a file name or - (stdin) follows */
p
++
;
/* pass the separator */
if
(
curlx_strequal
(
"-"
,
p
))
{
file
=
stdin
;
SET_BINMODE
(
stdin
);
...
...
@@ -2090,7 +2092,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
fclose
(
file
);
}
else
{
GetStr
(
&
postdata
,
++
p
);
GetStr
(
&
postdata
,
p
);
size
=
strlen
(
postdata
);
}
...
...
@@ -2108,8 +2110,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
char
*
n
=
malloc
(
outlen
);
if
(
!
n
)
return
PARAM_NO_MEM
;
snprintf
(
n
,
outlen
,
"%.*s=%s"
,
nlen
,
nextarg
,
enc
);
if
(
nlen
>
0
)
/* only append '=' if we have a name */
snprintf
(
n
,
outlen
,
"%.*s=%s"
,
nlen
,
nextarg
,
enc
);
else
strcpy
(
n
,
enc
);
curl_free
(
enc
);
free
(
postdata
);
if
(
n
)
{
...
...
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