Thanks Gustaf,

[join $hash “”] was the solution.  It works now!

Even though, I still have no idea why that happens. I’m using ns_* procs,  
simple and straight forward. As in:

>   % set h [ns_set create]
>   % ns_set update $h Authorization "Basic [ns_base64encode guest:guest]"
>   % ns_http run -headers $h https://jigsaw.w3.org/HTTP/Basic/ 
> <https://jigsaw.w3.org/HTTP/Basic/> 
> <https://jigsaw.w3.org/HTTP/Basic/ <https://jigsaw.w3.org/HTTP/Basic/>>


the only different is because strings are longer than “guest:guest"


Best wishes,
I


> On Raj. 13, 1442 AH, at 00:03, Gustaf Neumann <neum...@wu.ac.at> wrote:
> 
> 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
>  
> <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

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

Reply via email to