diff options
author | David Troy <dave@popvox.com> | 2006-04-02 19:04:27 +0000 |
---|---|---|
committer | David Troy <dave@popvox.com> | 2006-04-02 19:04:27 +0000 |
commit | 7885ebaa4f79cf908adb9e2a7fb252493c10026b (patch) | |
tree | 6008972bb9cbfc2ae9398360ed76526ab2a8c680 | |
parent | 7d5a0b34c0f7d35bbdf7ab62672d84c733c00bdd (diff) | |
download | astmanproxy-7885ebaa4f79cf908adb9e2a7fb252493c10026b.tar.gz astmanproxy-7885ebaa4f79cf908adb9e2a7fb252493c10026b.tar.xz astmanproxy-7885ebaa4f79cf908adb9e2a7fb252493c10026b.zip |
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@67 f02b47b9-160a-0410-81a6-dc3441afb0ec
-rw-r--r-- | src/common.c | 12 | ||||
-rw-r--r-- | src/http.c | 15 | ||||
-rw-r--r-- | src/ssl.c | 4 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/common.c b/src/common.c index 8ec016d..0855ac9 100644 --- a/src/common.c +++ b/src/common.c @@ -11,7 +11,8 @@ int get_input(struct mansession *s, char *output) struct pollfd fds[1]; char iabuf[INET_ADDRSTRLEN]; - debugmsg("in get_input"); + if (debug > 3) + debugmsg("in get_input"); /* Look for \r\n from the front, our preferred end of line */ for (x=0;x<s->inlen;x++) { @@ -36,19 +37,22 @@ int get_input(struct mansession *s, char *output) debugmsg("Warning: Got long line with no end from %s: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr), s->inbuf); s->inlen = 0; } - debugmsg("attempting poll operation"); + if (debug > 3) + debugmsg("attempting poll operation"); /* get actual fd, even if a negative SSL fd */ fds[0].fd = get_real_fd(s->fd); fds[0].events = POLLIN; res = poll(fds, 1, -1); - debugmsg("returned from poll op"); + if (debug > 3) + debugmsg("returned from poll op"); + if (res < 0 && debug) { debugmsg("Select returned error"); } else if (res > 0) { - pthread_mutex_lock(&s->lock); debugmsg("attempting socket read in get_input..."); + pthread_mutex_lock(&s->lock); /* read from socket; SSL or otherwise */ res = m_recv(s->fd, s->inbuf + s->inlen, sizeof(s->inbuf) - 1 - s->inlen, 0); pthread_mutex_unlock(&s->lock); @@ -16,6 +16,8 @@ int ParseHTTPInput(char *buf, struct message *m) { if ( !(*buf) ) return 0; */ + debugmsg("Parsing http input: %s", buf); + /* initialize message block */ memset(m, 0, sizeof (struct message) ); @@ -93,11 +95,13 @@ int _read(struct mansession *s, struct message *m) { s->inlen -= clength; pthread_mutex_unlock(&s->lock); } - debugmsg("method: %s", method); - debugmsg("clength: %d", clength); - debugmsg("formdata: %s", formdata); - debugmsg("s->inbuf: %s", s->inbuf); - debugmsg("s->inlen: %d", s->inlen); + if (debug) { + debugmsg("method: %s", method); + debugmsg("clength: %d", clength); + debugmsg("formdata: %s", formdata); + debugmsg("s->inbuf: %s", s->inbuf); + debugmsg("s->inlen: %d", s->inlen); + } BuildHTTPHeader(header); pthread_mutex_lock(&s->lock); @@ -121,6 +125,7 @@ int _read(struct mansession *s, struct message *m) { memcpy(formdata, line+6, strstr(line, " HTTP")-line-6); } else if ( !strncasecmp(line, "Content-Length: ", 16) ) { clength = atoi(line+16); + debugmsg("clength=%d", clength); } } } else if (res < 0) @@ -214,8 +214,8 @@ int m_recv(int s, void *buf, size_t len, int flags) if (ret > 0) rec_bytes += ret; - if (debug) - debugmsg("Received data from SSL socket - %d", ret); + if (debug && s<-1) + debugmsg("Received %d bytes from SSL socket", ret); return ret; } |