<div dir="ltr">Hi,<div><br></div><div>This is because req.hash is a BLOB, and isn't coverted implicitly into a string. Good news is you have access to vmod_blob that's bundled with varnish.</div><div><br></div><div>Here a self-contained test, you can run it using "varnishtest foo.vtc":</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>varnishtest "req.hash example"</div><div><br></div><div>server s1 {</div><div>  rxreq</div><div>  txresp</div><div>} -start</div><div><br></div><div>varnish v1 -vcl+backend {</div><div>  import blob;</div><div>  sub vcl_deliver {</div><div>    set resp.http.hash = blob.encode(HEX, blob=req.hash);</div><div>  }</div><div>} -start</div><div><br></div><div><br></div><div>client c1 {</div><div>  txreq -url /url/1</div><div>  rxresp</div><div>  expect resp.http.hash == "fd1d762b1bfbb23067ee15d0d0a8b026d51a99147b26d01f95215b4b277d6e8f"</div><div>} -run</div></blockquote><div><br></div><div>Three things to note:</div><div>- vsl_mask only enable the logging side of things, so it's independent from the VCL code</div><div>- please show us an error message, "it doesn't work" isn't an amazing explanation of what failed</div><div>- while a bit hardcore, you usually can look at <a href="https://github.com/varnishcache/varnish-cache/tree/master/bin/varnishtest/tests">https://github.com/varnishcache/varnish-cache/tree/master/bin/varnishtest/tests</a> for VCL examples</div><div><br></div><div>cheers,<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 2, 2019 at 1:50 PM L Cruzero <<a href="mailto:lcruzero@gmail.com">lcruzero@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I'm trying to put hash_data info onto a header for debugging purposes:</div><div><br></div>varnishd -V<br><div>varnishd (varnish-plus-6.0.3r6 revision bd7ae68d24df8ec166bd40b47726313c235b70a1)</div><div> </div><div>I'm able to see the hash values via varnishlog after setting these startup parameters:  DAEMON_OPTS=" -p vsl_mask=+Hash"</div><div><br></div><div>-   VCL_return     hash<br>-   VCL_call       HASH<br>-   Hash           "/ps01/3000_complete.m3u8%00"<br>-   Hash           "/ps01/3000_complete.m3u8%00"<br></div><div><br></div><div>however I'm not able to load the data onto a header under sub vcl_deliver with: </div><div><br></div><div>set resp.http.X.MY-DEBUG = req.http.X-MY-DEBUG + " HASH: "  + req.hash;</div><div><br></div><div> <br></div><div><br></div><div><br></div><div>Thanks,</div><div>Luis </div><div><br></div><div> </div><div><br></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>