Escape semicolon curl with -u option

0

I can't wrap my head around how to escape semicolon in username while making a GET request.

curl -u testclient:sdtest1:pass -XGET -H "Content-type:application/json" \
http://localhost:8081/hello

But the server says that credentials are invalid. How can I escape this?

Anton K.

Posted 2015-02-27T11:28:44.887

Reputation: 103

3One thing, those aren't semicolons. ; is a semicolon. – erikgaal – 2015-02-27T12:18:19.450

Answers

1

How do I escape a special character in a username while making a GET request.

Find the hexidecimal value of the value to be escaped, and prefix it with %.

So in your case, use the following:

curl -u testclient%3A:sdtest1:pass ...

"Is there any way that I can specify a username containing a colon"

"user:name:password" => "user%3Aname:password"

Source Specifying colon in authentication username

DavidPostill

Posted 2015-02-27T11:28:44.887

Reputation: 118 938