mg_iobuf_delete -> mg_iobuf_del

This commit is contained in:
Sergey Lyubka committed 2021-08-28 07:16:38 +01:00
1 parent bd64043377
commit 913e730ec2
15 files changed
+137 -146

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
memcpy(buf + sizeof(*h) + n, answer, sizeof(answer)); // And answer
mg_send(c, buf, sizeof(buf)); // And send it!
}
mg_iobuf_delete(&c->recv, c->recv.len);
mg_iobuf_del(&c->recv, 0, c->recv.len);
}
(void) fn_data;
(void) ev_data;
+1 -1
View File
@@ -39,7 +39,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
connected = true;
LOG(LL_DEBUG,
("Connected to proxy, status: %.*s", (int) hm.uri.len, hm.uri.ptr));
mg_iobuf_delete(&c->recv, n);
mg_iobuf_del(&c->recv, 0, n);
// Send request to the target server
mg_printf(c, "GET / HTTP/1.0\r\nHost: %.*s\r\n\r\n", (int) host.len,
host.ptr);
+1 -1
View File
@@ -56,7 +56,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (c->label[0] == 'B' && c2 != NULL) {
// All incoming data from the backend, forward to the client
mg_send(c2, c->recv.buf, c->recv.len);
mg_iobuf_delete(&c->recv, c->recv.len);
mg_iobuf_del(&c->recv, 0, c->recv.len);
}
} else if (ev == MG_EV_CONNECT) {
if (mg_url_is_ssl(s_backend_url)) {
+3 -3
View File
@@ -53,7 +53,7 @@ static void handshake(struct mg_connection *c) {
// TODO(lsm): support other auth methods
if (r->buf[i] == HANDSHAKE_NOAUTH) reply[1] = r->buf[i];
}
mg_iobuf_delete(r, 2 + r->buf[1]);
mg_iobuf_del(r, 0, 2 + r->buf[1]);
mg_send(c, reply, sizeof(reply));
c->label[0] = STATE_REQUEST;
}
@@ -73,7 +73,7 @@ static void exchange(struct mg_connection *c) {
struct mg_connection *c2 = (struct mg_connection *) c->fn_data;
if (c2 != NULL) {
mg_send(c2, c->recv.buf, c->recv.len);
mg_iobuf_delete(&c->recv, c->recv.len);
mg_iobuf_del(&c->recv, 0, c->recv.len);
} else {
c->is_draining = 1;
}
@@ -145,7 +145,7 @@ static void request(struct mg_connection *c) {
mg_send(c, buf, sizeof(buf));
}
mg_send(c, r->buf + 3, addr_len + 1 + 2);
mg_iobuf_delete(r, 6 + addr_len); // Remove request from the input stream
mg_iobuf_del(r, 0, 6 + addr_len); // Remove request from the input stream
c->label[0] = STATE_ESTABLISHED; // Mark ourselves as connected
}
+1 -1
View File
@@ -24,7 +24,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
// Got websocket frame. Received data is wm->data. Echo it back!
struct mg_ws_message *wm = (struct mg_ws_message *) ev_data;
mg_ws_send(c, wm->data.ptr, wm->data.len, WEBSOCKET_OP_TEXT);
mg_iobuf_delete(&c->recv, c->recv.len);
mg_iobuf_del(&c->recv, 0, c->recv.len);
}
(void) fn_data;
}
+1 -1
View File
@@ -34,7 +34,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
// Got websocket frame. Received data is wm->data. Echo it back!
struct mg_ws_message *wm = (struct mg_ws_message *) ev_data;
mg_ws_send(c, wm->data.ptr, wm->data.len, WEBSOCKET_OP_TEXT);
mg_iobuf_delete(&c->recv, c->recv.len);
mg_iobuf_del(&c->recv, 0, c->recv.len);
}
(void) fn_data;
}