httpheaderconnectiontype.c (1159B)
1 /************************************************************************* 2 * This file is part of Crosroads 1.23, a load balancer and fail over 3 * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. 4 * Visit http://crossroads.e-tunity.com for information. 5 *************************************************************************/ 6 #include "crossroads.h" 7 8 HttpConnectionType http_header_connectiontype (HttpHeader *h) { 9 unsigned char const *val; 10 11 if (! (val = http_header_val (h, "proxy-connection")) ) 12 val = http_header_val (h, "connection"); 13 14 if (!val) { 15 msg ("Service %s: Cannot determine connection type, " 16 "no such header", activeservice->name); 17 return (con_unknown); 18 } 19 if (strcasestr ((char const *)val, "close")) { 20 msg ("Service %s: Connection-Type is CLOSE", 21 activeservice->name); 22 return (con_close); 23 } else if (strcasestr ((char const *)val, "keep-alive")) { 24 msg ("Service %s: Connection-Type is KEEP-ALIVE", 25 activeservice->name); 26 return (con_keepalive); 27 } 28 warning ("Service %s: Unsupported Connection-Type '%s'", 29 activeservice->name, val); 30 return (con_unknown); 31 }