1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
11 #include <anna/core/core.hpp>
13 #include <anna/io/BinaryReader.hpp>
15 #include <anna/http/Transport.hpp>
16 #include <anna/http/Message.hpp>
20 int main (int argc, const char** argv)
22 CommandLine& commandLine (CommandLine::instantiate ());
23 io::BinaryReader reader (32 * 1024);
24 DataBlock contain (true);
25 const DataBlock* block;
26 http::Transport transport;
27 const http::Message* message;
29 Logger::setLevel (Logger::Debug);
30 Logger::initialize ("ims_buffer", new TraceWriter ("file.trace", 4096000));
33 commandLine.add ("f", CommandLine::Argument::Mandatory, "Nombre del fichero a interpretar");
35 commandLine.initialize (argv, argc);
36 commandLine.verify ();
38 // Lee el contenido del fichero indicado y lo guarda en el buffer
39 reader.open (commandLine.getValue ("f"));
40 while ((block = reader.fetch ()) != NULL)
43 const char* buffer = contain.getData ();
44 const int length = contain.getSize ();
46 message = transport.externalDecode (buffer, length);
48 cout << message->asString () << endl;
50 for (http::Message::const_header_iterator ii = message->header_begin (), maxii = message->header_end (); ii != maxii; ii ++)
51 cout << "\t" << http::Message::header (ii)->asString () << endl;
52 cout << functions::asString (message->getBody ()) << endl << endl;
54 catch (Exception& ex) {
55 cout << ex.asString () << endl << endl;