Browse code

core: use req.start for http11 tcp read

- shifting back chunks is done with memmove - safer for overlapping
buffers
- credits to Andrei Pelinescu-Onciul

Daniel-Constantin Mierla authored on 31/08/2010 21:24:04
Showing 1 changed files
... ...
@@ -145,7 +145,7 @@ int tcp_http11_continue(struct tcp_connection *c)
145 145
 		return 0;
146 146
 
147 147
 	/* check for Expect header */
148
-	if(strstr(c->req.buf, "Expect: 100-continue")!=NULL)
148
+	if(strstr(c->req.start, "Expect: 100-continue")!=NULL)
149 149
 	{
150 150
 		init_dst_from_rcv(&dst, &c->rcv);
151 151
 		if (tcp_send(&dst, 0, HTTP11CONTINUE, HTTP11CONTINUE_LEN) < 0) {
... ...
@@ -153,7 +153,7 @@ int tcp_http11_continue(struct tcp_connection *c)
153 153
 		}
154 154
 	}
155 155
 	/* check for Transfer-Encoding header */
156
-	if(strstr(c->req.buf, "Transfer-Encoding: chunked")!=NULL)
156
+	if(strstr(c->req.start, "Transfer-Encoding: chunked")!=NULL)
157 157
 	{
158 158
 		c->req.flags |= F_TCP_REQ_BCHUNKED;
159 159
 		ret = 1;
... ...
@@ -745,7 +745,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
745 745
 					r->state = H_HTTP11_CHUNK_END;
746 746
 					/* shift back body content */
747 747
 					if(r->chunk_size>0 && p-r->chunk_size>r->body) {
748
-						memcpy(r->body + r->content_len, p - r->chunk_size,
748
+						memmove(r->body + r->content_len, p - r->chunk_size,
749 749
 								r->chunk_size);
750 750
 						r->content_len += r->chunk_size;
751 751
 					}