if (debug) log(L_DEBUG, "read_connection: recv(%d, %p, %d, 0) = %d", fd, p->end, i, nr);
static void read_connection(struct connection *cn){	int i, nr, fd;	register char c;	struct pool *p;	register char state;	p = cn->input;	state = p->state;	cn->action = HC_READING;	fd = cn->fd;	i = p->ceiling - p->end;	if (i == 0) {		log(L_ERROR, "input buffer full");		cn->action = HC_CLOSING;		return;	}	nr = recv(fd, p->end, i, MSG_PEEK);	if (nr == -1) {		switch (errno) {		default:			log(L_ERROR, "error peeking from %s", cn->ip);			lerror("recv");		case ECONNRESET:			cn->action = HC_CLOSING;		case EAGAIN:			return;		}	}	if (nr == 0) {		cn->action = HC_CLOSING;		return;	}	i = 0;	while (i < nr && state < 8) {		c = p->end[i++];		switch (state) {		case 0:			switch (c) {			case ' ':			case '\t':			case '\r':				state = 1;				break;			case '\n':				state = 9;				break;			}			break;		case 1:			switch (c) {			default:				state = 2;			case ' ':			case '\t':			case '\r':				break;			case '\n':				state = 9;				break;			}			break;		case 2:			switch (c) {			case ' ':			case '\t':			case '\r':				state = 3;				break;			case '\n':				state = 9;				break;			}			break;		case 3:			switch (c) {			default:				cn->assbackwards = 0;				state = 4;			case ' ':			case '\t':			case '\r':				break;			case '\n':				state = 8;				break;			}			break;		case 4:			switch (c) {			case '\r':				state = 5;				break;			case '\n':				state = 6;				break;			}			break;		case 5:			switch (c) {			default:				state = 4;			case '\r':				break;			case '\n':				state = 6;				break;			}			break;		case 6:			switch (c) {			case '\r':				state = 7;				break;			case '\n':				state = 8;				break;			default:				state = 4;				break;			}			break;		case 7:			switch (c) {			default:				state = 4;			case '\r':				break;			case '\n':				state = 8;				break;			}			break;		}	}	nr = recv(fd, p->end, i, 0);	if (nr != i) {		if (nr == -1)			log(L_ERROR, "error reading from %s", cn->ip);			lerror("recv");		cn->action = HC_CLOSING;		return;	}	if (state == 9) {		log(L_ERROR, "bad message from %s", cn->ip);		cn->action = HC_CLOSING;		return;	}	p->end += i;	p->state = state;	if (state == 8) {		if (process_request(cn->r) == -1 || fill_connection(cn) == -1)			cn->action = HC_CLOSING;		else {			cn->action = HC_WRITING;			write_connection(cn);		}	}	cn->t = current_time;}