Dear Iuri,

The problem, you are probably facing is probably that ns_base64encode produces line breaks as required for MIME encoded text strings [1].

% ns_base64encode 
Afrewf564DFSFSF54jgnfhgGDGdfRGRT43:7584fjhfjhf84jkrugrefAFFD9449474

QWZyZXdmNTY0REZTRlNGNTRqZ25maGdHREdkZlJHUlQ0Mzo3NTg0ZmpoZmpo
Zjg0amtydWdyZWZBRkZEOTQ0OTQ3NA==

Converting to and from a string with these linebreaks should be fine for all base64 codecs (you see, colon is not the problem)

% ns_base64decode [ns_base64encode 
Afrewf564DFSFSF54jgnfhgGDGdfRGRT43:7584fjhfjhf84jkrugrefAFFD9449474]

Afrewf564DFSFSF54jgnfhgGDGdfRGRT43:7584fjhfjhf84jkrugrefAFFD9449474

But probably, the header field has problems with linebreaks. Therefore, simply remove the newlines by e.g.

set credentials [join [ns_base64encode 
Afrewf564DFSFSF54jgnfhgGDGdfRGRT43:7584fjhfjhf84jkrugrefAFFD9449474] ""]
set req_headers [ns_set create headers Authorization "Basic $credentials"]

All the best
-g

PS: In order to see, what is sent via and and/or node, use tcpdump and/or wireshark, then you do not have to do any guessing, what is exactly sent by which command in which implementation....

[1] https://unix.stackexchange.com/questions/447191/whats-the-right-way-to-base64-encode-a-binary-file-on-centos-7#:~:text=base64%20inserts%20line%20breaks%20after,Transfer%2DEncoding%20for%20emails).


_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to