fetchRemote overwrites responseInfo table with status code on fail

Đang mở
#5,433 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, lua
Lĩnh vực
backend

Hướng nghiên cứu

Start by locating the new fetchRemote implementation and its callback handling; the issue does not name source files or tests. Reproduce a failed request where the remote end returns an error, then inspect the callback arguments against the documented responseInfo table contract. Done when failures pass a table with the documented fields and the callback no longer errors when reading success.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Describe the bug

When new implementation of fetchRemote fails due to network stack and the callback function is called, the responseInfo table is overwritten with the network status code.

function fetchRemoteCallback(responseData, tblResponseInfo, ...)
-- on fail, lua will report: attempt to index local tblResponseInfo (a number value)
-- if the response is OK, it will be a table with success attribute set to true
if(not tblResponseInfo.success) then
error("fetchRemote failed");
end
end

According to the wiki, it should always return a table and youre supposed to use success and statusCode attributes for error handling:

callbackFunction: This is the function that should receive the data returned from the remote server. The callback argument list should be:

responseData - A string containing the remote response
responseInfo - A table containing:
    success - A boolean indicating if the request was successful.
    statusCode - An integer status/error code. See the list of possible error values below.
    headers - A table containing the HTTP response headers
arguments... - The arguments that were passed into fetchRemote
Steps to reproduce

Use the new fetchRemote implementation and request data where remote end actively sends an error back

Version

No response

Additional context

No response

Relevant log output

Security Policy
  • I have read and understood the Security Policy and this issue is not security related.
Ngôn ngữ chính
C++
Star
1.9k
Fork
588
Merge trung bình
4 ngày 9 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của multitheftauto/mtasa-blue

Tất cả issue của multitheftauto/mtasa-blue

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.