whmapi1 editzonerecord "+" character
Hello,
Can anyone shed some light on the following behaviour.
I'm running a command such as the below:
The record line updates fine, however the plus signs (+) in the txtdata are replaced with spaces. I've tried using unencoded=0 and unencoded=1, which makes no difference. I've tried wrapping the txtdata in quotes as suggested in the API docs but it seems the API actually does this automatically when writing to the zone, as my quotes are escaped and wrapped in another set of quotes. As such, I believe the above is the correct command, but I'm puzzled as to why the + signs are being stripped, which are part if the original record being replaced. Thanks
whmapi1 editzonerecord domain='domain.com' line=26 name='domain.com.' class=IN ttl=14400 type=TXT txtdata='v=spf1 +a +mx +ip4:1.1.1.1 include:spf.domain.net ~all'The record line updates fine, however the plus signs (+) in the txtdata are replaced with spaces. I've tried using unencoded=0 and unencoded=1, which makes no difference. I've tried wrapping the txtdata in quotes as suggested in the API docs but it seems the API actually does this automatically when writing to the zone, as my quotes are escaped and wrapped in another set of quotes. As such, I believe the above is the correct command, but I'm puzzled as to why the + signs are being stripped, which are part if the original record being replaced. Thanks
-
whmapi1 editzonerecord domain='domain.com' line=26 name='domain.com.' class=IN ttl=14400 type=TXT txtdata='v=spf1 +a +mx +ip4:1.1.1.1 include:spf.domain.net ~all'
Hello, You will need to encode the entry if you are using those characters. For example, here's an unencoded entry:v=spf1 +a +mx +ip4:1.1.1.1 include:spf.domain.net ~all
Encoded, it looks like this:v%3Dspf1%20%2Ba%20%2Bmx%20%2Bip4%3A1.1.1.1%20include%3Aspf.domain.net%20~all
I tested this with the following command and it worked properly:whmapi1 editzonerecord domain=cptest01.tld line=38 name=cptest01.tld. class=IN ttl=14400 type=TXT txtdata="v%3Dspf1%20%2Ba%20%2Bmx%20%2Bip4%3A1.1.1.1%20%2Binclude%3Aspf.domain.net%20~all" unencoded=1
The updated entry in the zone includes the + symbols:# grep spf /var/named/cptest01.tld.db cptest01.tld. 14400 IN TXT "v=spf1 +a +mx +ip4:1.1.1.1 include:spf.domain.net ~all"
Thank you.0 -
Perfect, thanks for all of your help today @cPanelMichael! For anyone else reading, for clarification, the encoding is URL Encoding. 0
Please sign in to leave a comment.
Comments
2 comments