varnish / libvmod-digest

Digest and HMAC vmod
Other
50 stars 27 forks source link

hash_md5 failing #1

Closed huguesalary closed 10 years ago

huguesalary commented 12 years ago

Hi there,

I just compiled your vmod on my Mac Os X 10.6.8

$varnishd -V
varnishd (varnish-3.0.2 revision 55e70a4)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS

I tried using the digest.hash_md5() function in my VCL, the VCL compiles with no error, but when I make an HTTP request, nothing is returned to the browser.

I then tried using digest.hash_sha1, and it works.

VCL Config

import digest;

sub vcl_deliver
{
    set resp.http.whatever = digest.hash_md5("test");
}

Varnishlog

0 CLI          - Rd ping
0 CLI          - Wr 200 19 PONG 1349724370 1.0
8 BackendOpen  b default 127.0.0.1 49639 127.0.0.1 8080
8 TxRequest    b GET
8 TxURL        b /
8 TxProtocol   b HTTP/1.1
8 TxHeader     b Host: xxx.dyndns.org
8 TxHeader     b Pragma: no-cache
8 TxHeader     b User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
8 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
8 TxHeader     b Accept-Language: en-US,en;q=0.8,fr;q=0.6
8 TxHeader     b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
8 TxHeader     b Cookie: __unam=d8cb8fc-1373474e385-fb57489-1; __utmx=61625407.; __utmxx=61625407.; __utmx=1.; __utmxx=1.; __utma=1.55154200.1338591865.1339534723.1340041951.9; __utmz=1.1338591865.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=61625407.20100163
8 TxHeader     b ABTest: TESTa
8 TxHeader     b X-Device: desktop
8 TxHeader     b X-Varnish: 1830513611
8 TxHeader     b Accept-Encoding: gzip
8 RxProtocol   b HTTP/1.1
8 RxStatus     b 200
8 RxResponse   b OK
8 RxHeader     b Date: Mon, 08 Oct 2012 19:26:11 GMT
8 RxHeader     b Server: Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
8 RxHeader     b X-Powered-By: PHP/5.3.1
8 RxHeader     b Expires: Thu, 19 Nov 1981 08:52:00 GMT
8 RxHeader     b Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
8 RxHeader     b Pragma: no-cache
8 RxHeader     b Set-Cookie: frontend=6de3c6b09cb15240fba3e718f92abc34; expires=Tue, 09-Oct-2012 19:26:11 GMT; path=/; domain=.xxx.dyndns.org; httponly
8 RxHeader     b X-Magento-Doesi: 1
8 RxHeader     b Transfer-Encoding: chunked
8 RxHeader     b Content-Type: text/html; charset=UTF-8
8 Fetch_Body   b 3(chunked) cls 0 mklen 1
8 Length       b 8708
8 BackendReuse b default
0 WorkThread   - 0x100586ae0 start
0 CLI          - Rd vcl.load "boot" ./vcl.osJuJwUo.so
0 CLI          - Wr 200 36 Loaded "./vcl.osJuJwUo.so" as "boot"
0 CLI          - Rd vcl.use "boot"
0 CLI          - Wr 200 0 
0 CLI          - Rd start
0 Debug        - "Acceptor poll space increased to 512"
0 Debug        - "Acceptor is poll"
0 CLI          - Wr 200 0 
0 WorkThread   - 0x106703ae0 start
0 WorkThread   - 0x106786ae0 start
0 WorkThread   - 0x107880ae0 start
0 WorkThread   - 0x107903ae0 start
0 WorkThread   - 0x107986ae0 start
0 WorkThread   - 0x107a09ae0 start
0 WorkThread   - 0x107a8cae0 start
0 WorkThread   - 0x107b0fae0 start
0 WorkThread   - 0x107b92ae0 start
0 CLI          - Rd ping
0 CLI          - Wr 200 19 PONG 1349724375 1.0
0 CLI          - Rd ping
0 CLI          - Wr 200 19 PONG 1349724378 1.0

Am I missing something?

-Hugues

KristianLyng commented 12 years ago

Could you try to run 'make check' ?

huguesalary commented 12 years ago

The make check fails for me, but it actually fails for every single vmod I compile. I suspect a problem with varnishadm on the mac os x port. If I read the test well, it seems to fail because varnishadm is supposedly not answering. But we clearly see later that it does. Something that also makes me think there's a problem with varnishadm is that when I start it and use it, there's no prompt. Typing a command and validating with [enter] will execute the command normally though. I added a picture, that should help.

$make check

Making check in src
/Users/hugues/Downloads/varnish-3.0.2/bin/varnishtest/varnishtest -Dvarnishd=/Users/hugues/Downloads/varnish-3.0.2/bin/varnishd/varnishd -Dvmod_topbuild=/Users/hugues/libvmod-digest tests/test01.vtc
**** top   0.0 macro def varnishd=/Users/hugues/Downloads/varnish-3.0.2/bin/varnishd/varnishd
**** top   0.0 macro def vmod_topbuild=/Users/hugues/libvmod-digest
**** top   0.0 macro def pwd=/Users/hugues/libvmod-digest/src
**** top   0.0 macro def topbuild=/Users/hugues/libvmod-digest/src/../..
**** top   0.0 macro def bad_ip=10.255.255.255
**** top   0.0 macro def tmpdir=/tmp/vtc.72111.0aa822c9
*    top   0.0 TEST tests/test01.vtc starting
***  top   0.0 varnishtest
*    top   0.0 TEST Test digest vmod
***  top   0.0 server
**   s1    0.0 Starting server
**** s1    0.0 macro def s1_addr=127.0.0.1
**** s1    0.0 macro def s1_port=50707
**** s1    0.0 macro def s1_sock=127.0.0.1 50707
*    s1    0.0 Listen on 127.0.0.1 50707
**   s1    0.0 Started on 127.0.0.1 50707
***  top   0.0 varnish
**   v1    0.0 Launch
***  v1    0.0 CMD: cd ${pwd} && ${varnishd} -d -d -n /tmp/vtc.72111.0aa822c9/v1 -l 10m,1m,- -p auto_restart=off -p syslog_cli_traffic=off -a '127.0.0.1:0' -S /tmp/vtc.72111.0aa822c9/v1/_S -M '127.0.0.1 50708' -P /tmp/vtc.72111.0aa822c9/v1/varnishd.pid -sfile,/tmp/vtc.72111.0aa822c9/v1,10M 
***  v1    0.0 CMD: cd /Users/hugues/libvmod-digest/src && /Users/hugues/Downloads/varnish-3.0.2/bin/varnishd/varnishd -d -d -n /tmp/vtc.72111.0aa822c9/v1 -l 10m,1m,- -p auto_restart=off -p syslog_cli_traffic=off -a '127.0.0.1:0' -S /tmp/vtc.72111.0aa822c9/v1/_S -M '127.0.0.1 50708' -P /tmp/vtc.72111.0aa822c9/v1/varnishd.pid -sfile,/tmp/vtc.72111.0aa822c9/v1,10M 
***  v1    0.0 PID: 72129
**** v1    0.1 CLIPOLL 0 0x0 0x0
---- v1    0.1 FAIL timeout waiting for CLI connection
*    top   0.1 RESETTING after tests/test01.vtc
***  v1    0.1 debug| Platform: Darwin,10.8.0,x86_64,-sfile,-smalloc,-hcritbit\n
**   s1    0.1 Waiting for server
**** s1    0.1 macro undef s1_addr
**** s1    0.1 macro undef s1_port
**** s1    0.1 macro undef s1_sock
***  v1    0.1 debug| 200 233     \n
***  v1    0.1 debug| -----------------------------\n
***  v1    0.1 debug| Varnish Cache CLI 1.0\n
***  v1    0.1 debug| -----------------------------\n
***  v1    0.1 debug| Darwin,10.8.0,x86_64,-sfile,-smalloc,-hcritbit\n
***  v1    0.1 debug| \n
***  v1    0.1 debug| Type 'help' for command list.\n
***  v1    0.1 debug| Type 'quit' to close CLI session.\n
***  v1    0.1 debug| Type 'start' to launch worker process.\n
***  v1    0.1 debug| \n
**   v1    1.1 Wait
**   v1    1.1 R 72129 Status: 0000
*    top   1.2 TEST tests/test01.vtc FAILED

#     top  TEST tests/test01.vtc FAILED (1.183) exit=1
make[1]: *** [tests/test01.vtc] Error 2
make: *** [check-recursive] Error 1

varnishadm

lkarsten commented 11 years ago

Hi.

From what I see it appears that libmhash has a problem on BSD and macos. The rest works. The libvmod-digest layer between Varnish and libmhash is pretty thin.

The varnishadm problem you describe is probably readline/editline related and shouldn't influence this vmod in any way.

Are you still experiencing this? What libmhash version are you running?

huguesalary commented 11 years ago

Hi Lasse,

I haven't tried on the latest version of Varnish. As soon as I can I'll compile the latest version and try again.

-Hugues

daghf commented 10 years ago

Related: https://github.com/varnish/libvmod-digest/issues/2