HTTPFileRequest: only save file if status == 200
This commit is contained in:
@@ -38,6 +38,9 @@ namespace HTTP
|
||||
{
|
||||
Request::responseHeadersComplete();
|
||||
|
||||
if( responseCode() != 200 )
|
||||
return setFailure(responseCode(), responseReason());
|
||||
|
||||
if( !_filename.empty() )
|
||||
{
|
||||
// TODO validate path? (would require to expose fgValidatePath somehow to
|
||||
@@ -69,8 +72,8 @@ namespace HTTP
|
||||
SG_LOG
|
||||
(
|
||||
SG_IO,
|
||||
SG_WARN,
|
||||
"HTTP::FileRequest: error writing to '" << _filename << "'"
|
||||
SG_DEBUG,
|
||||
"HTTP::FileRequest: received data for closed file '" << _filename << "'"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -177,6 +177,8 @@ protected:
|
||||
virtual void onFail();
|
||||
virtual void onAlways();
|
||||
|
||||
void setFailure(int code, const std::string& reason);
|
||||
|
||||
private:
|
||||
friend class Client;
|
||||
friend class Connection;
|
||||
@@ -186,7 +188,6 @@ private:
|
||||
Request& operator=(const Request&); // = delete;
|
||||
|
||||
void processBodyBytes(const char* s, int n);
|
||||
void setFailure(int code, const std::string& reason);
|
||||
void setReadyState(ReadyState state);
|
||||
|
||||
std::string _method;
|
||||
|
||||
Reference in New Issue
Block a user