1 // Written by James Turner
3 // Copyright (C) 2013 James Turner <zakalawe@mac.com>
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Library General Public
7 // License as published by the Free Software Foundation; either
8 // version 2 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef SG_HTTP_CONTENT_DECODER_HXX
21 #define SG_HTTP_CONTENT_DECODER_HXX
27 #include <simgear/io/HTTPRequest.hxx>
44 void initWithRequest(Request_ptr req);
48 void setEncoding(const std::string& encoding);
50 void receivedBytes(const char* n, size_t s);
52 size_t getTotalReceivedBytes() const
53 { return _totalReceivedBytes; }
55 bool consumeGZipHeader();
58 void consumeBytes(size_t consumed);
59 void reallocateInputBuffer(size_t newSize);
62 unsigned char* _output;
65 unsigned char* _input;
66 size_t _inputAllocated, _inputSize;
67 bool _contentDeflate, _needGZipHeader;
68 size_t _totalReceivedBytes;
71 } // of namespace HTTP
73 } // of namespace simgear
75 #endif // of SG_HTTP_CONTENT_DECODER_HXX