1 // Larbin
2 // Sebastien Ailleret
3 // 07-12-01 -> 07-12-01
4
5 #include <iostream>
6 #include <cstring>
7 #include <unistd.h>
8
9 #include "options.h"
10
11 #include "types.h"
12 #include "global.h"
13 #include "fetch/file.h"
14 #include "utils/text.h"
15 #include "utils/debug.h"
16 #include "interf/output.h"
17
18 /** A page has been loaded successfully
19 * @param page the page that has been fetched
20 */
loaded(html * page)21 void loaded (html *page) {
22 // Here should be the code for managing everything
23 // page->getHeaders() gives a char* containing the http headers
24 // page->getPage() gives a char* containing the page itself
25 // those char* are statically allocated, so you should copy
26 // them if you want to keep them
27 // in order to accept \000 in the page, you can use page->getLength()
28 #ifdef BIGSTATS
29 std::cout << "fetched : ";
30 page->getUrl()->print();
31 // std::cout << page->getHeaders() << "\n" << page->getPage() << "\n";
32 #endif // BIGSTATS
33 }
34
35 /** The fetch failed
36 * @param u the URL of the doc
37 * @param reason reason of the fail
38 */
failure(url * u,FetchError reason)39 void failure (url *u, FetchError reason) {
40 // Here should be the code for managing everything
41 #ifdef BIGSTATS
42 std::cout << "fetched failed (" << (int) reason << ") : ";
43 u->print();
44 #endif // BIGSTATS
45 }
46
47 /** initialisation function
48 */
initUserOutput()49 void initUserOutput () {
50
51 }
52
53 /** stats, called in particular by the webserver
54 * the webserver is in another thread, so be careful
55 * However, if it only reads things, it is probably not useful
56 * to use mutex, because incoherence in the webserver is not as critical
57 * as efficiency
58 */
outputStats(int fds)59 void outputStats(int fds) {
60 ecrire(fds, "Nothing to declare");
61 }
62