if (r->protocol_major > 1 || r->protocol_minor > 1) {
if (r->protocol_major > 1 || (r->protocol_major == 1 && r->protocol_minor > 1)) {
static int process_headers(struct request *r){	char *l, *u, *s;	time_t i;	size_t n;	int multiple_range;	unsigned long cl;	do {		l = getline(r->cn->input, 0);		if (l == 0)			return -1;	} while (*l == 0);	u = strchr(l, ' ');	if (u == 0)		return -1;	r->method_s = l;	*u++ = 0;	if (r->cn->assbackwards)		r->protocol_minor = 9;	else {		s = strrchr(u, 'H');		if (s == 0 || s == u || s[-1] != ' ') {			log_d("no HTTP-Version in Request-Line");			return -1;		}		r->version = s;		s[-1] = 0;		if (parse_http_version(r) == -1) {			r->cn->keepalive = 0;			return 400;		}	}	r->url = u;	s = strchr(u, '?');	if (s) {		r->args = s + 1;		*s = 0;	}	n = 0;	multiple_range = 0;	while ((l = getline(r->cn->input, 1)) != 0) {		s = strchr(l, ':');		if (s == 0)			continue;		*s++ = 0;		while (*s == ' ')			++s;		if (*s == 0)			continue;		if (n < tuning.num_headers) {			r->headers[n].rh_name = l;			r->headers[n++].rh_value = s;		}		if (!strcasecmp(l, "User-agent"))			r->user_agent = s;		else if (!strcasecmp(l, "Referer"))			r->referer = s;		else if (!strcasecmp(l, "Authorization"))			r->authorization = s;		else if (!strcasecmp(l, "Host")) {			sanitize_host(s);			r->host = s;		} else if (!strcasecmp(l, "If-Modified-Since"))			r->ims_s = s;		else if (!strcasecmp(l, "If-Unmodified-Since"))			r->ius_s = s;		else if (!strcasecmp(l, "Content-type"))			r->in_content_type = s;		else if (!strcasecmp(l, "Content-length"))			r->in_content_length = s;		else if (!strcasecmp(l, "Range")) {			if (r->range_s)				multiple_range = 1;			else				r->range_s = s;		} else if (!strcasecmp(l, "If-Range"))			r->if_range_s = s;		else if (!strcasecmp(l, "Transfer-Encoding"))			r->in_transfer_encoding = s;	}	r->nheaders = n;	s = r->method_s;	if (strcmp(s, m_get) == 0)		r->method = M_GET;	else {		if (r->cn->assbackwards)			return 501;		if (strcmp(s, m_head) == 0)			r->method = M_HEAD;		else if (strcmp(s, m_post) == 0)			r->method = M_POST;		else			return 501;	}	s = r->url;	if (strlen(s) > STRLEN)		return 414;	if (*s != '/') {		if (r->cn->assbackwards)			return 400;		u = strchr(s, '/');		if (u == 0 || u[1] != '/' || u[2] == 0 || u[2] == '/')			return 400;		u += 2;		s = strchr(u, '/');		if (s == 0)			return 400;		memcpy(r->rhost, u, s - u);		r->rhost[s - u] = 0;		r->host = r->rhost;	}	if (unescape_url(s, r->path) == -1)		return 400;	if (r->protocol_major > 1 || r->protocol_minor > 1) {		log_d("%s: unsupported version HTTP/%d.%d", inet_ntoa(r->cn->peer.sin_addr), r->protocol_major, r->protocol_minor);			return 505;	}	if (r->in_transfer_encoding) {		if (strcasecmp(r->in_transfer_encoding, "chunked")) {			log_d("unimplemented transfer-coding \"%s\"", r->in_transfer_encoding);			return 501;		}		if (r->in_content_length) {			log_d("ignoring Content-Length header from client");			r->in_content_length = 0;		}	}	s = r->in_content_length;	if (s) {		if (*s == '-' || (cl = strtoul(s, &u, 10), u == s || *u || cl >= UINT_MAX)) {			log_d("bad Content-Length from client: \"%s\"", s);			return 400;		}		r->in_mblen = cl;	}	if (r->method == M_GET) {		s = r->ims_s;		if (s) {			i = timerfc(s);			if (i != -1)				r->ims = i;		}		s = r->ius_s;		if (s) {			i = timerfc(s);			if (i != -1)				r->ius = i;		}		s = r->if_range_s;		if (s) {			i = timerfc(s);			if (i != -1)				r->if_range = i;		}		if (multiple_range)			log_d("multiple Range headers!?");		else {			s = r->range_s;			if (s) {				if (parse_range_header(r, s) == -1)					log_d("ignoring Range header \"%s\"", s);			}		}	} else if (r->method == M_POST) {		if (r->in_content_length == 0)			return 411;	}	return 0;}