/*
- * $Id: HttpMsg.cc,v 1.36 2006/10/01 17:27:10 adrian Exp $
+ * $Id: HttpMsg.cc,v 1.37 2006/10/02 01:34:18 adrian Exp $
*
* DEBUG: section 74 HTTP Message
* AUTHOR: Alex Rousskov
hdr->bufsiz = bufsiz;
hdr->req_start = hdr->req_end = -1;
hdr->hdr_start = hdr->hdr_end = -1;
+ debug(74, 5)("httpParseInit: Request buffer is %s\n", buf);
}
#if MSGDODEBUG
int maj = -1, min = -1;
int last_whitespace = -1, line_end = -1;
+ debug(74, 5)("httpParserParseReqLine: parsing %s\n", hmsg->buf);
+
PROF_start(HttpParserParseReqLine);
/* Find \r\n - end of URL+Version (and the request) */
hmsg->req_end = -1;
retcode = 0;
goto finish;
}
- assert(hmsg->buf[hmsg->req_end] != '\n' && hmsg->buf[hmsg->req_end] != '\r');
+ assert(hmsg->buf[hmsg->req_end] != '\n');
+ assert(hmsg->buf[hmsg->req_end - 1] == '\n');
/* Start at the beginning again */
i = 0;
assert(maj != -1);
assert(min != -1);
PROF_stop(HttpParserParseReqLine);
- debug(1, 1) ("Parser: retval %d: from %d->%d: method %d->%d; url %d->%d; version %d->%d (%d/%d)\n",
+ debug(74, 5) ("Parser: retval %d: from %d->%d: method %d->%d; url %d->%d; version %d->%d (%d/%d)\n",
retcode, hmsg->req_start, hmsg->req_end,
hmsg->m_start, hmsg->m_end,
hmsg->u_start, hmsg->u_end,
/*
- * $Id: HttpMsg.h,v 1.13 2006/09/27 13:47:53 adrian Exp $
+ * $Id: HttpMsg.h,v 1.14 2006/10/02 01:34:18 adrian Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
extern void HttpParserInit(HttpParser *, const char *buf, int len);
extern int HttpParserParseReqLine(HttpParser *hp);
+#define MSGDODEBUG 0
#if MSGDODEBUG
extern int HttpParserReqSz(HttpParser *);
extern int HttpParserHdrSz(HttpParser *);
/*
- * $Id: client_side.cc,v 1.740 2006/09/27 13:47:53 adrian Exp $
+ * $Id: client_side.cc,v 1.741 2006/10/02 01:34:18 adrian Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
HttpRequest *request = NULL;
/* We have an initial client stream in place should it be needed */
/* setup our private context */
- connNoteUseOfBuffer(conn.getRaw(), http->req_sz);
-
context->registerWithConn();
if (context->flags.parsed_ok == 0) {
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
if ((request = HttpRequest::CreateFromUrlAndMethod(http->uri, method)) == NULL) {
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
/* compile headers */
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
request->flags.accelerated = http->flags.accel;
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
http->request = HTTPMSGLOCK(request);
assert(context->http->out.offset == 0);
context->pullData();
conn->flags.readMoreRequests = false;
- return;
+ goto finish;
}
context->mayUseConnection(true);
http->calloutContext = new ClientRequestContext(http);
http->doCallouts();
+
+finish:
+ /* Consume request buffer */
+ connNoteUseOfBuffer(conn.getRaw(), http->req_sz);
}
static void