src/proto_http.c
static inline int http_skip_chunk_crlf(struct http_msg *msg)
{
	const struct buffer *buf = msg->chn->buf;
	const char *ptr;
	int bytes;

	/* NB: we'll check data availabilty at the end. It's not a
	 * problem because whatever we match first will be checked
	 * against the correct length.
	 */
	bytes = 1;
	ptr = buf->p;
	if (*ptr == '\r') {
		bytes++;
		ptr++;
		if (ptr >= buf->data + buf->size)
			ptr = buf->data;
	}

	if (bytes > buf->i)
		return 0;

	if (*ptr != '\n') {
		msg->err_pos = buffer_count(buf, buf->p, ptr);
		return -1;
	}

	ptr++;
	if (unlikely(ptr >= buf->data + buf->size))
		ptr = buf->data;
	/* prepare the CRLF to be forwarded (between ->sol and ->sov) */
	msg->sol = 0;
	msg->sov = msg->next = bytes;
	msg->msg_state = HTTP_MSG_CHUNK_SIZE;
	return 1;
}
/* This function may be called only in HTTP_MSG_CHUNK_CRLF. It reads the CRLF or
 * a possible LF alone at the end of a chunk. It automatically adjusts msg->sov,
 * ->sol, ->next in order to include this part into the next forwarding phase.
 * Note that the caller must ensure that ->p points to the first byte to parse.
 * It also sets msg_state to HTTP_MSG_CHUNK_SIZE and returns >0 on success. If
 * not enough data are available, the function does not change anything and
 * returns zero. If a parse error is encountered, the function returns < 0 and
 * does not change anything. Note: this function is designed to parse wrapped
 * CRLF at the end of the buffer.
 */
This function may be called only in HTTP_MSG_CHUNK_CRLF. It reads the CRLF or
a possible LF alone at the end of a chunk. It automatically adjusts msg->sov,
->sol, ->next in order to include this part into the next forwarding phase.
Note that the caller must ensure that ->p points to the first byte to parse.
It also sets msg_state to HTTP_MSG_CHUNK_SIZE and returns >0 on success. If
not enough data are available, the function does not change anything and
returns zero. If a parse error is encountered, the function returns < 0 and
does not change anything. Note: this function is designed to parse wrapped
CRLF at the end of the buffer.
This function may be called only in HTTP_MSG_CHUNK_CRLF . It reads the CRLF or a possible LF alone at the end of a chunk . It automatically adjusts msg - > sov - > sol - > next in order to include this part into the next forwarding phase . Note that the caller must ensure that - > p points to the first byte to parse . It also sets msg_state to HTTP_MSG_CHUNK_SIZE and returns > 0 on success . If not enough data are available the function does not change anything and returns zero . If a parse error is encountered the function returns < 0 and does not change anything . Note : this function is designed to parse wrapped CRLF at the end of the buffer .
static inline int http_skip_chunk_crlf(struct http_msg *msg)
{
	const struct buffer *buf = msg->chn->buf;
	const char *ptr;
	int bytes;
	bytes = 1;
	ptr = buf->p;
	if (*ptr == '\r') {
		bytes++;
		ptr++;
		if (ptr >= buf->data + buf->size)
			ptr = buf->data;
	}
	if (bytes > buf->i)
		return 0;
	if (*ptr != '\n') {
		msg->err_pos = buffer_count(buf, buf->p, ptr);
		return -1;
	}
	ptr++;
	if (unlikely(ptr >= buf->data + buf->size))
		ptr = buf->data;
	msg->sol = 0;
	msg->sov = msg->next = bytes;
	msg->msg_state = HTTP_MSG_CHUNK_SIZE;
	return 1;
}
static inline int http_skip_chunk_crlf ( struct http_msg * msg ) { const struct buffer * buf = msg -> chn -> buf ; const char * ptr ; int bytes ; bytes = 1 ; ptr = buf -> p ; if ( * ptr == ' \r ' ) { bytes ++ ; ptr ++ ; if ( ptr >= buf -> data + buf -> size ) ptr = buf -> data ; } if ( bytes > buf -> i ) return 0 ; if ( * ptr != ' \n ' ) { msg -> err_pos = buffer_count ( buf , buf -> p , ptr ) ; return -1 ; } ptr ++ ; if ( unlikely ( ptr >= buf -> data + buf -> size ) ) ptr = buf -> data ; msg -> sol = 0 ; msg -> sov = msg -> next = bytes ; msg -> msg_state = HTTP_MSG_CHUNK_SIZE ; return 1 ; }
This function may be called only in HTTP_MSG_CHUNK_CRLF.
This function may be called only in HTTP_MSG_CHUNK_CRLF .
/* NB: we'll check data availabilty at the end. It's not a
	 * problem because whatever we match first will be checked
	 * against the correct length.
	 */ /* prepare the CRLF to be forwarded (between ->sol and ->sov) */