Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPV6 Curl POST request

Tags:

post

curl

ipv6

In IPV6 how to build CURL POST http request with the IPV6 address and port number.Any kind of thread will be appreciated.

Tried to build the request as below

>curl --interface 'http://[2001:0:db8:1111:0:0:0:11]:8091/?'

But above gave error as "curl: NO URL specified"

>curl -X POST -d  curl -X POST `http://[2001:0:db8:1111:0:0:0:11]:8091/?`

Then tried the above that gave error as

>bash: http://[2001:0:db8:1111:0:0:0:11]:8091/?: No such file or directory
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

Is there any alternate method, other than using URL

like image 275
user3555809 Avatar asked Jan 22 '26 10:01

user3555809


2 Answers

curl -g -d post 'http://[2001:0:db8:1111:0:0:0:11]:8091/'

The -g option was necessary "back in the old days" when you used IPv6 addresses. It stops curl from treating the [] symbols in the URL as globbing instructions. (since curl 7.37.0 (May 2014), curl no longer mistakes numerical IPv6 addresses for globbing, making the use of -g in this case no longer necessary)

The -d is of course for posting. You can slap on a -v too to get to see details from the operation.

(And no, -X POST should not be in the command line at all when -d is used.)

like image 104
Daniel Stenberg Avatar answered Jan 24 '26 09:01

Daniel Stenberg


curl -4 for an IPv4 request and curl -6 for an IPv6 request are the arguments, that you can use.

For your examle, this should work:

curl -6 -d post 'http://2001:0:db8:1111:0:0:0:11:8091/'

like image 24
mkirbst Avatar answered Jan 24 '26 10:01

mkirbst