summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2024-08-18 14:17:56 +0300
committerGitHub <noreply@github.com>2024-08-18 14:17:56 +0300
commit42f3974a543fa0ba06092538bd338e0a641ea17c (patch)
tree8dcae22b5210233127468dc01e7bee5d1fb04916
parent922a6e956320513940cd1e6734f62995c7e5718e (diff)
parent4fbba4715bd82a104713cf95b0ae2ac622968879 (diff)
downloadaccel-ppp-42f3974a543fa0ba06092538bd338e0a641ea17c.tar.gz
accel-ppp-42f3974a543fa0ba06092538bd338e0a641ea17c.zip
Merge pull request #163 from dpokrovsky/http-error-fix
Fixes the issue #124 "HTTP replay for non SSTP query" and log_debug2 in Triton lib
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 2e2c4d3b..2a9ddae3 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -187,6 +187,7 @@ static unsigned int stat_active;
static inline void sstp_queue(struct sstp_conn_t *conn, struct buffer_t *buf);
static int sstp_send(struct sstp_conn_t *conn, struct buffer_t *buf);
static inline void sstp_queue_deferred(struct sstp_conn_t *conn, struct buffer_t *buf);
+static int sstp_write(struct triton_md_handler_t *h);
static int sstp_read_deferred(struct sstp_conn_t *conn);
static int sstp_abort(struct sstp_conn_t *conn, int disconnect);
static void sstp_disconnect(struct sstp_conn_t *conn);
@@ -858,7 +859,7 @@ static int http_send_response(struct sstp_conn_t *conn, char *proto, char *statu
}
}
- return sstp_send(conn, buf);
+ return sstp_send(conn, buf) || sstp_write(&conn->hnd);
}
static int http_recv_request(struct sstp_conn_t *conn, uint8_t *data, int len)
@@ -937,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;
@@ -963,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;
@@ -1950,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);
}