[sr-dev] git:master: core: use req.start for http11 tcp read

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 31 23:25:43 CEST 2010


Module: sip-router
Branch: master
Commit: 38f1ee418f7249b713e5f4cdaa8f9fa5c19ad093
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=38f1ee418f7249b713e5f4cdaa8f9fa5c19ad093

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Aug 31 23:24:04 2010 +0200

core: use req.start for http11 tcp read

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

---

 tcp_read.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tcp_read.c b/tcp_read.c
index e152f5b..b8be180 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -145,7 +145,7 @@ int tcp_http11_continue(struct tcp_connection *c)
 		return 0;
 
 	/* check for Expect header */
-	if(strstr(c->req.buf, "Expect: 100-continue")!=NULL)
+	if(strstr(c->req.start, "Expect: 100-continue")!=NULL)
 	{
 		init_dst_from_rcv(&dst, &c->rcv);
 		if (tcp_send(&dst, 0, HTTP11CONTINUE, HTTP11CONTINUE_LEN) < 0) {
@@ -153,7 +153,7 @@ int tcp_http11_continue(struct tcp_connection *c)
 		}
 	}
 	/* check for Transfer-Encoding header */
-	if(strstr(c->req.buf, "Transfer-Encoding: chunked")!=NULL)
+	if(strstr(c->req.start, "Transfer-Encoding: chunked")!=NULL)
 	{
 		c->req.flags |= F_TCP_REQ_BCHUNKED;
 		ret = 1;
@@ -745,7 +745,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
 					r->state = H_HTTP11_CHUNK_END;
 					/* shift back body content */
 					if(r->chunk_size>0 && p-r->chunk_size>r->body) {
-						memcpy(r->body + r->content_len, p - r->chunk_size,
+						memmove(r->body + r->content_len, p - r->chunk_size,
 								r->chunk_size);
 						r->content_len += r->chunk_size;
 					}




More information about the sr-dev mailing list