Application crashes on http request (SOLVED)

#1

While trying to execute http request application crashes.

local function http_result(self, _, response)
    print(response.status)
    print(response.response)
    pprint(response.headers)
end

http.request('http://aws...', 'DELETE', http_result, headers)
Assertion failed: (response.m_ContentLength == -1), function DoDoRequest, file ../src/dlib/http_client.cpp, line 924.
INFO:CRASH: Successfully wrote Crashdump to file: /Users/.../Library/Application Support/Defold/_crash
ERROR:CRASH: CALL STACK:

# 0 pc   0x117db42d MetadataUtilities _sigtramp+29

Trying to do the same request with postman does not replicates the issue.
Response is 204 No Content

0 Likes

#2

Do you get “Content-Length” response header? With a 204 response code no Content-Length header should be sent from the server:

https://tools.ietf.org/html/rfc7230#section-3.3.2

But it’s a bit silly that we assert the check for content length. It would be much better if we simply ignore any content length received when the response code is 204.

2 Likes

#3

It returns header Content-Length 0.
Changed to 200, everything passed fine.

0 Likes

#4

Issue: https://github.com/defold/defold/issues/5271

0 Likes

#5

This is likely a fairly quick fix if anyone from the community would like to try and fix it!

1 Like