1/*
2 * Copyright 2010 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Christophe Huriaux, c.huriaux@gmail.com
7 */
8
9#include <iostream>
10#include <cstdio>
11
12#include <UrlProtocol.h>
13#include <UrlProtocolListener.h>
14
15using namespace std;
16
17
18void
19BUrlProtocolListener::ConnectionOpened(BUrlProtocol*)
20{
21}
22
23
24void
25BUrlProtocolListener::HostnameResolved(BUrlProtocol*, const char*)
26{
27}
28
29
30void
31BUrlProtocolListener::ResponseStarted(BUrlProtocol*)
32{
33}
34
35
36void
37BUrlProtocolListener::HeadersReceived(BUrlProtocol*)
38{
39}
40
41
42void
43BUrlProtocolListener::DataReceived(BUrlProtocol*, const char*, ssize_t)
44{
45}
46
47
48void
49BUrlProtocolListener::DownloadProgress(BUrlProtocol*, ssize_t, ssize_t)
50{
51}
52
53
54void
55BUrlProtocolListener::UploadProgress(BUrlProtocol*, ssize_t, ssize_t)
56{
57}
58
59
60void
61BUrlProtocolListener::RequestCompleted(BUrlProtocol*, bool)
62{
63}
64
65
66void
67BUrlProtocolListener::DebugMessage(BUrlProtocol* caller,
68	BUrlProtocolDebugMessage type, const char* text)
69{
70	switch (type) {
71		case B_URL_PROTOCOL_DEBUG_TEXT:
72			cout << "   ";
73			break;
74
75		case B_URL_PROTOCOL_DEBUG_ERROR:
76			cout << "!!!";
77			break;
78
79		case B_URL_PROTOCOL_DEBUG_TRANSFER_IN:
80		case B_URL_PROTOCOL_DEBUG_HEADER_IN:
81			cout << "<--";
82			break;
83
84		case B_URL_PROTOCOL_DEBUG_TRANSFER_OUT:
85		case B_URL_PROTOCOL_DEBUG_HEADER_OUT:
86			cout << "-->";
87			break;
88	}
89
90	cout << " " << caller->Protocol() << ": " << text << endl;
91}
92