Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration-Option on how OAPIF-Driver generates error-messages #10653

Closed
hebersgit opened this issue Aug 26, 2024 · 2 comments · Fixed by #10658
Closed

Configuration-Option on how OAPIF-Driver generates error-messages #10653

hebersgit opened this issue Aug 26, 2024 · 2 comments · Fixed by #10658
Assignees

Comments

@hebersgit
Copy link

Feature description

Provide an option on how in OGROAPIFDataset::Download, in conditional block if (psResult->pszErrBuf != nullptr) (currently line 434 ff) the error is generated. There is an assumption made that psResult->pabyData contains the error-text which isn't true in all cases and depends on the server and the type of error which occured in CPLHTTPFetchEx . It would be safer to prefer content of psResult->pszErrBuf instead of psResult->pabyData.

Additional context

On some computer I have no debugging-access to, the following occured:
While processing the OAPIF-Download within CPLHTTPFetchEx (gdal/port/cpl_http.cpp) and using curl, an error "Send failure: Connection was aborted." occured, but the download-result seems to be completely fetched. So psResult->pabyData contains the regular GeoJson-response from the server, while psResult->pszErrBuf contains the error-text ("Send failure: Connection was aborted."). In OGROAPIFDataset::Download in the conditional block if (psResult->pszErrBuf != nullptr), an error is generated containing the whole OGC Feature-API GeoJson as error-text!

@rouault
Copy link
Member

rouault commented Aug 26, 2024

@hebersgit Can you point to this server? But at first sight, I don't see anything wrong in the current implementation of the OAPIF driver. The pabyData could very well be corrupted if pszErrBuf is not null. This looks like a server issue, not a client one

@hebersgit
Copy link
Author

Hi Even, thank you for inspecting this request. I'm sorry, but this server can't be accessed from outside at the moment. We use geoserver with an own API-gateway before it. I fully agree to you, that this is a problem with the server or the connection to it. Additionally, the problem occurs only occasionally.
What I mean is the following: In OGROAPIFDataset::Download, if psResult->pszErrBuf != nullptr, one can't rely on the fact that psResult->pabyData contains an error-message. If one handles the received errors (if GetFeature() returns null e.g.) by inspecting the last error message, the information on the error is lost because psResult->pszErrBuf isn't used. Therefore, I would propose to change ogroapifdriver.cpp, lines 435-437 to always use psResult->pszErrBuf and never psResult->pabyData (or at least a concatenation of psResult->pszErrBuf and psResult->pabyData).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants