Skip to content

Commit f436aad

Browse files
juhaylinentrantanen
authored andcommitted
app: Remove body length check for HTTP POST/PUT requests
The body length check was a leftover from the old implementation that required buffering the entire request body before sending. Now that the client supports streaming request bodies of arbitrary size, this check is no longer necessary. The check for SM_DATAMODE_FLAGS_MORE_DATA is also removed as the body is sent as a raw stream. Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
1 parent 40aa72c commit f436aad

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

app/src/sm_at_httpc.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ LOG_MODULE_REGISTER(sm_httpc, CONFIG_SM_LOG_LEVEL);
2323
#define HTTP_URL_MAX_LEN 512
2424
#define HTTP_HOST_MAX_LEN 256
2525
#define HTTP_PATH_MAX_LEN 256
26-
#define HTTP_REQUEST_BODY_MAX_LEN CONFIG_SM_DATAMODE_BUF_SIZE
2726
#define HTTP_EXTRA_HEADERS_SIZE 512
2827
#define HTTP_RESPONSE_TIMEOUT_MS CONFIG_SM_HTTPC_RESPONSE_TIMEOUT_MS
2928
#define HTTP_MAX_REQUESTS NRF_MODEM_MAX_SOCKET_COUNT
@@ -883,12 +882,6 @@ static int http_datamode_callback(uint8_t op, const uint8_t *data, int len, uint
883882
int err = 0;
884883

885884
if (op == DATAMODE_SEND) {
886-
if ((flags & SM_DATAMODE_FLAGS_MORE_DATA) != 0) {
887-
LOG_ERR("Data mode buffer overflow");
888-
exit_datamode_handler(sm_at_host_get_current(), -EOVERFLOW);
889-
return -EOVERFLOW;
890-
}
891-
892885
if (!datamode_req) {
893886
LOG_ERR("No request for data mode");
894887
exit_datamode_handler(sm_at_host_get_current(), -EINVAL);
@@ -1066,9 +1059,8 @@ STATIC int handle_at_httpcreq(enum at_parser_cmd_type cmd_type, struct at_parser
10661059
if (at_parser_num_get(parser, next_param_idx, &tmp) == 0) {
10671060
if (method == HTTP_POST || method == HTTP_PUT) {
10681061
body_len = tmp;
1069-
if (body_len < 0 || body_len > HTTP_REQUEST_BODY_MAX_LEN) {
1070-
LOG_ERR("Invalid body_len: %d (max %d)", body_len,
1071-
HTTP_REQUEST_BODY_MAX_LEN);
1062+
if (body_len < 0) {
1063+
LOG_ERR("Invalid body_len: %d", body_len);
10721064
http_close_request(req);
10731065
return -EINVAL;
10741066
}

0 commit comments

Comments
 (0)