mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-19 23:59:04 +00:00
Added support for upload log compression client-side.
This commit is contained in:
parent
6310d50ec3
commit
c735bc01a0
@ -1,6 +1,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2005 - 2009 by Rusty Russell <rusty@rustcorp.com.au>
|
||||
Copyright (C) 2009 by Greg Shikhman <cornmander@cornmander.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -14,7 +15,7 @@
|
||||
|
||||
/**
|
||||
* @file upload_log.cpp
|
||||
* Manage logfiles for uploading as feedback, e.g.\ for champaign-balancing.
|
||||
* Manage logfiles for uploading as feedback, e.g.\ for campaign-balancing.
|
||||
*/
|
||||
|
||||
#include "global.hpp"
|
||||
@ -32,6 +33,9 @@
|
||||
#include "unit_map.hpp"
|
||||
#include "wesconfig.h"
|
||||
|
||||
#include <boost/iostreams/filtering_stream.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
|
||||
static lg::log_domain log_uploader("uploader");
|
||||
#define DBG_UPLD LOG_STREAM(debug, log_uploader)
|
||||
#define ERR_UPLD LOG_STREAM(err, log_uploader)
|
||||
@ -199,7 +203,7 @@ static int upload_logs_dev(void *_ti)
|
||||
send_string(sock, "Content-length: ");
|
||||
send_string(sock, lexical_cast<std::string>(contents.length()));
|
||||
send_string(sock, "\n\n");
|
||||
send_string(sock, contents.c_str());
|
||||
send_string(sock, contents);
|
||||
|
||||
// As long as we can actually send the data, delete the file.
|
||||
// Even if the server gives a bad response, we don't want to
|
||||
@ -281,7 +285,15 @@ upload_log::~upload_log()
|
||||
#endif
|
||||
|
||||
std::ostream *out = ostream_file(filename_);
|
||||
write(*out, config_);
|
||||
|
||||
if(uploader_settings::new_uploader) {
|
||||
boost::iostreams::filtering_stream<boost::iostreams::output> filter;
|
||||
filter.push(boost::iostreams::gzip_compressor());
|
||||
filter.push(*out);
|
||||
write(filter, config_);
|
||||
} else {
|
||||
write(*out, config_);
|
||||
}
|
||||
delete out;
|
||||
|
||||
if (upload_log::manager_)
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2005 - 2009 by Rusty Russell <rusty@rustcorp.com.au>
|
||||
Copyright (C) 2009 by Greg Shikhman <cornmander@cornmander.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
Loading…
x
Reference in New Issue
Block a user