cURL -d . parameter

I have this curl command:

curl -k -d . -o SessionRequest.txt
""

What does -d . stand for? What does it do?

1 Answer

Whenever your have a doubt use man.

Issue man curl and read about -d switch.

-d, --data <data> (HTTP) Sends the specified data in a POST request to the HTTP cause curl to pass the data to the server using the content-type -d, --data is the same as --data-ascii. --data-raw is almost the ter. To post data purely binary, you should instead use the [...] 

It allows you to send ASCII data, eg.:

curl -d '{"hello": "world"}' -X POST -H "Content-Type: application/json" 

Send a JSON string to the server.

In your example, it just send a . character as ASCII data to the server. What it does depends on the server logic and is out of the curl command scope.

This said, we can guess what a . (dot, period, full stop) might mean in computer science:

  • Dot is a placeholder for the current directory in Unix File Systems;
  • Dot is a wildcard for any character in most Regular Expression grammars;
  • Dot is the separator between labels in domain name;
  • Dot is a common separator for filename and extension;

Nota: It is considered as a bad practice to send credentials using GET parameters, avoid it if you can and read more.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like