Re: Inline C and memory allocation

2009-07-07 Thread Laurence Rowe
I'm not certain if I need to manage the memory of the string that I
set the header too. It looks like VRT_SetHdr copies the string into
it's own memory managed space though.

That just leaves me with the task of allocating enough memory to
perform base64 decoding, md5 calculation etc. I guess I can just
allocate a large buffer on the stack and test that I won't overrun it.

2009/7/7 Ken Brownfield kb+varn...@slide.com:
 Isn't VRT_SetHdr() what you're looking for?  Mind its semantics, though.
 --
 Ken.

 On Jul 6, 2009, at 7:26 AM, Laurence Rowe wrote:

 Hi,

 Thought my C is rather rusty by now, I'd like to make the mod_auth_tkt
 [1] signed cookie authentication / authorisation system work with
 Varnish. The idea would be to encode the acceptable authorisation
 tokens for a page into it's response header then check the tokens in
 the user's auth_tkt cookie against the tokens in the cached header
 during vcl_deliver.

 I can find examples online that read data from headers using
 VRT_GetHdr, but in order to implement/port mod_auth_tkt I will need to
 decode the data in the cookie and write the decoded contents to new
 headers. With apache, I would use apr_psprintf or similar to allocate
 memory from the pool. What would be the equivalent in Varnish?

 Laurence

 [1] http://www.openfusion.com.au/labs/mod_auth_tkt/
 ___
 varnish-misc mailing list
 varnish-misc@projects.linpro.no
 http://projects.linpro.no/mailman/listinfo/varnish-misc


___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: tcp reset problem with varnish 2.0.4 o n Solaris 10 (SPARC)

2009-07-07 Thread Alex Hooper
Ken Brownfield uttered:
 Your tcpdump seems to imply that there's an immediate timeout on the
 connection.  Do the timeouts (and other settings) emitted from
 varnishadm -T :6082 param.show all have sane values?
 

As far as I can tell...:

accept_fd_holdoff  50 [ms]
acceptor   default (ports, poll)
auto_restart   on [bool]
backend_http11 on [bool]
between_bytes_timeout  60.00 [s]
cache_vbe_connsoff [bool]
cc_command cc -Kpic -G -o %o %s
cli_buffer 8192 [bytes]
cli_timeout5 [seconds]
client_http11  off [bool]
clock_skew 10 [s]
connect_timeout5.00 [s]
default_grace  10
default_ttl120 [seconds]
diag_bitmap0x0 [bitmap]
err_ttl0 [seconds]
esi_syntax 0 [bitmap]
fetch_chunksize128 [kilobytes]
first_byte_timeout 60.00 [s]
group  nobody (60001)
listen_address :80
listen_depth   1024 [connections]
log_hashstring off [bool]
log_local_address  off [bool]
lru_interval   2 [seconds]
max_esi_includes   5 [includes]
max_restarts   4 [restarts]
obj_workspace  8192 [bytes]
overflow_max   100 [%]
ping_interval  3 [seconds]
pipe_timeout   60 [seconds]
prefer_ipv6off [bool]
purge_dups off [bool]
purge_hash on [bool]
rush_exponent  3 [requests per request]
send_timeout   600 [seconds]
sess_timeout   5 [seconds]
sess_workspace 16384 [bytes]
session_linger 0 [ms]
shm_reclen 255 [bytes]
shm_workspace  8192 [bytes]
srcaddr_hash   1049 [buckets]
srcaddr_ttl30 [seconds]
thread_pool_add_delay  20 [milliseconds]
thread_pool_add_threshold  2 [requests]
thread_pool_fail_delay 200 [milliseconds]
thread_pool_max500 [threads]
thread_pool_min5 [threads]
thread_pool_purge_delay1000 [milliseconds]
thread_pool_timeout300 [seconds]
thread_pools   2 [pools]
user   nobody (60001)
vcl_trace  off [bool]


I did note this in config.log; not sure if it implies the kind of
problem I'm seeing:

configure:19586: checking whether SO_SNDTIMEO works
configure:19629: gcc -std=gnu99 -o conftest -g -O2   conftest.c  5
Undefined   first referenced
 symbol in file
socket  /var/tmp//ccKa38Tg.o
setsockopt  /var/tmp//ccKa38Tg.o
ld: fatal: Symbol referencing errors. No output written to conftest
...
configure:19673: WARNING: connection timeouts will not work


 You might also experiment by adding a probe to your backend, to see if
 the probes pass.
 

They show as sick, with the same reset symptom in tcpdump.

 Otherwise, I guess I'd suspect an issue with compilation.  They say
 Varnish only supports gcc (which might not be strictly true, but I'll
 bet it's not tested under the Sun compiler).  What was the isfinite()
 issue?

The same as that reported at
http://varnish.projects.linpro.no/ticket/464. Actually, having re-tried,
I can get around the isfinite() issue with the provided patch, but am
caught by the second issue with NAN. I get:


gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../include
-DVARNISH_STATE_DIR='/local/var/varnish' -g -O2 -MT
varnishd-cache_center.o -MD -MP -MF .deps/varnishd-cache_center.Tpo -c
-o varnishd-cache_center.o `test -f 'cache_center.c' || echo
'./'`cache_center.c
cache_center.c: In function `cnt_done':
cache_center.c:234: error: incompatible types in assignment
cache_center.c:241: error: incompatible types in assignment
*** Error code 1

It's starting to look as though there may be a few too many issues with
Varnish on Solaris currently. I'll keep trying to resolve, but time
issues may force me to fall back to squid for the moment.

Cheers,

Alex.
-- 
Alex Hooper   |  w www.bmjpg.com
Systems and Database Administration   |  e ahoo...@bmjgroup.com
BMJ Technology, BMJ Publishing Group  |  t +44 20 7383 6049
BMA House, LONDON, WC1H 9JR   |



___
The BMJ Group is one of the world's most trusted providers of medical 
information for doctors, researchers, health care workers and patients 
www.bmjgroup.bmj.com.  This email and any attachments are confidential.  If you 
have received this email in error, please delete it and kindly notify us.  If 
the email contains personal views then the BMJ Group accepts no responsibility 
for these statements.  The recipient should check this email and attachments 
for viruses because the BMJ Group accepts no liability for any damage caused by