diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-08-28 16:54:41 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-08-28 17:22:19 +0200 |
commit | a12af6a6e15b934253e4215e844e295f1bd09304 (patch) | |
tree | 4a628a1f4c203f35cd8c5ef8331c44907fca1503 | |
parent | 15685e618fa33b23655bd86f9ea7f9571a570ca2 (diff) |
#915 add syslog error when HTTP request processing fails
-rw-r--r-- | sources/ogAdmServer.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index 0c3396e..1f2667b 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -4143,8 +4143,15 @@ static int og_client_state_process_payload_rest(struct og_client *cli) if (root) json_decref(root); - if (!err) - err = og_client_ok(cli, buf_reply); + if (err < 0) + return err; + + err = og_client_ok(cli, buf_reply); + if (err < 0) { + syslog(LOG_ERR, "HTTP response to %s:%hu is too large\n", + inet_ntoa(cli->addr.sin_addr), + ntohs(cli->addr.sin_port)); + } return err; } @@ -4234,10 +4241,16 @@ static void og_client_read_cb(struct ev_loop *loop, struct ev_io *io, int events cli->state = OG_CLIENT_PROCESSING_REQUEST; /* fall through. */ case OG_CLIENT_PROCESSING_REQUEST: - if (cli->rest) + if (cli->rest) { ret = og_client_state_process_payload_rest(cli); - else + if (ret < 0) { + syslog(LOG_ERR, "Failed to process HTTP request from %s:%hu\n", + inet_ntoa(cli->addr.sin_addr), + ntohs(cli->addr.sin_port)); + } + } else { ret = og_client_state_process_payload(cli); + } if (ret < 0) goto close; |