fetchRemote overwrites responseInfo table with status code on fail

Abierto
#5,433 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp, lua
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
C++
Estrellas
1.9k
Forks
588
Merge medio
4 d 9 min
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de multitheftauto/mtasa-blue

Todos los issues de multitheftauto/mtasa-blue

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.