summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Pokrovsky <dpokrovsky@hotmail.com>2024-06-14 16:17:56 +0300
committerDmitry Pokrovsky <dpokrovsky@hotmail.com>2024-06-14 16:17:56 +0300
commit4fbba4715bd82a104713cf95b0ae2ac622968879 (patch)
tree2f9e0090a61b9ba668633502c91ec1dd0c0d0b01
parent382b02b6a123fd4d74099e163e54ea0663e9f956 (diff)
downloadaccel-ppp-4fbba4715bd82a104713cf95b0ae2ac622968879.tar.gz
accel-ppp-4fbba4715bd82a104713cf95b0ae2ac622968879.zip
Fixes the issue #124 "HTTP replay for non SSTP query"
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 63bde053..2a9ddae3 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -859,7 +859,7 @@ static int http_send_response(struct sstp_conn_t *conn, char *proto, char *statu
}
}
- return sstp_send(conn, buf) && sstp_write(&conn->hnd);
+ return sstp_send(conn, buf) || sstp_write(&conn->hnd);
}
static int http_recv_request(struct sstp_conn_t *conn, uint8_t *data, int len)
@@ -938,7 +938,7 @@ static int http_handler(struct sstp_conn_t *conn, struct buffer_t *buf)
static const char *table[] = { "\n\r\n", "\r\r\n", NULL };
const char **pptr;
uint8_t *ptr, *end = NULL;
- int n;
+ int n, r;
if (conn->sstp_state != STATE_SERVER_CALL_DISCONNECTED)
return -1;
@@ -964,8 +964,11 @@ static int http_handler(struct sstp_conn_t *conn, struct buffer_t *buf)
} else
n = end - buf->head;
- if (http_recv_request(conn, buf->head, n) < 0)
+ r = http_recv_request(conn, buf->head, n);
+ if (r < 0)
return -1;
+ else if (r > 0)
+ return 1;
buf_pull(buf, n);
conn->sstp_state = STATE_SERVER_CONNECT_REQUEST_PENDING;
@@ -1951,6 +1954,8 @@ static int sstp_read(struct triton_md_handler_t *h)
n = conn->handler(conn, buf);
if (n < 0)
goto drop;
+ else if (n > 0)
+ return 1;
buf_expand_tail(buf, SSTP_MAX_PACKET_SIZE);
}