Skip to content

Commit

Permalink
Networking: report empty server response
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Sep 18, 2024
1 parent 5a9a2ca commit 0025c78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/networking_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);

close(state->sockfd);
if (buffer->length == 0) return "Empty server response received";
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
}
1 change: 1 addition & 0 deletions src/common/networking_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,6 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);

closesocket(state->sockfd);
if (buffer->length == 0) return "Empty server response received";
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
}

0 comments on commit 0025c78

Please sign in to comment.