summaryrefslogtreecommitdiffstats
path: root/src/http.c
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-03 19:39:36 +0000
committerDavid Troy <dave@popvox.com>2006-04-03 19:39:36 +0000
commit7122b49be0d135619e6eb848798b4bc620a9b808 (patch)
treed821e24702e9e67b28fd6143504b9fa028c57276 /src/http.c
parentecc49089c697a2cb7331358def5ce7640fae65bf (diff)
downloadastmanproxy-7122b49be0d135619e6eb848798b4bc620a9b808.tar.gz
astmanproxy-7122b49be0d135619e6eb848798b4bc620a9b808.tar.xz
astmanproxy-7122b49be0d135619e6eb848798b4bc620a9b808.zip
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@74 f02b47b9-160a-0410-81a6-dc3441afb0ec
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/http.c b/src/http.c
index 91c3de0..fcc6bcc 100644
--- a/src/http.c
+++ b/src/http.c
@@ -12,10 +12,6 @@
int ParseHTTPInput(char *buf, struct message *m) {
char *n, *v;
- /* initialize message block
- memset(m, 0, sizeof (struct message) );
- */
-
n = buf;
while ( (v = strstr(n, "=")) ) {
v += 1;
@@ -66,15 +62,18 @@ int _read(struct mansession *s, struct message *m) {
char line[MAX_LEN], method[10], formdata[MAX_LEN], header[MAX_LEN];
int res, clength = 0;
- if (s->dead)
- return -1;
-
memset(method, 0, sizeof method);
memset(formdata, 0, sizeof formdata);
memset(header, 0, sizeof header);
/* for http, don't do get_input forever */
for (;;) {
+
+ if (s->inputcomplete && !s->outputcomplete)
+ continue;
+ else if (s->inputcomplete && s->outputcomplete)
+ return -1;
+
memset(line, 0, sizeof line);
res = get_input(s, line);
debugmsg("res=%d, line: %s",res, line);
@@ -107,6 +106,7 @@ int _read(struct mansession *s, struct message *m) {
BuildHTTPHeader(header);
pthread_mutex_lock(&s->lock);
+ s->inputcomplete = 1;
ast_carefulwrite(s->fd, header, strlen(header), s->writetimeout);
pthread_mutex_unlock(&s->lock);
debugmsg("header: %s", header);