xref: /haiku/src/kits/network/libnetservices/UrlProtocolListener.cpp (revision 70b63f18b32a7ae90e4ff49659ba3844ce4c9aa5)
1 /*
2  * Copyright 2010-2017 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  *		Adrien Destugues, pulkomandy@pulkomandy.tk
8  */
9 
10 #include <cstdio>
11 
12 #include <UrlRequest.h>
13 #include <UrlProtocolListener.h>
14 
15 using namespace std;
16 using namespace BPrivate::Network;
17 
18 
19 void
ConnectionOpened(BUrlRequest *)20 BUrlProtocolListener::ConnectionOpened(BUrlRequest*)
21 {
22 }
23 
24 
25 void
HostnameResolved(BUrlRequest *,const char *)26 BUrlProtocolListener::HostnameResolved(BUrlRequest*, const char*)
27 {
28 }
29 
30 
31 bool
CertificateVerificationFailed(BUrlRequest * caller,BCertificate & certificate,const char * message)32 BUrlProtocolListener::CertificateVerificationFailed(BUrlRequest* caller,
33 	BCertificate& certificate, const char* message)
34 {
35 	return false;
36 }
37 
38 
39 void
ResponseStarted(BUrlRequest *)40 BUrlProtocolListener::ResponseStarted(BUrlRequest*)
41 {
42 }
43 
44 
45 
46 void
HeadersReceived(BUrlRequest *)47 BUrlProtocolListener::HeadersReceived(BUrlRequest*)
48 {
49 }
50 
51 
52 void
BytesWritten(BUrlRequest *,size_t)53 BUrlProtocolListener::BytesWritten(BUrlRequest*, size_t)
54 {
55 }
56 
57 
58 void
DownloadProgress(BUrlRequest *,off_t,off_t)59 BUrlProtocolListener::DownloadProgress(BUrlRequest*, off_t, off_t)
60 {
61 }
62 
63 
64 void
UploadProgress(BUrlRequest *,off_t,off_t)65 BUrlProtocolListener::UploadProgress(BUrlRequest*, off_t, off_t)
66 {
67 }
68 
69 
70 void
RequestCompleted(BUrlRequest *,bool)71 BUrlProtocolListener::RequestCompleted(BUrlRequest*, bool)
72 {
73 }
74 
75 
76 void
DebugMessage(BUrlRequest * caller,BUrlProtocolDebugMessage type,const char * text)77 BUrlProtocolListener::DebugMessage(BUrlRequest* caller,
78 	BUrlProtocolDebugMessage type, const char* text)
79 {
80 #ifdef DEBUG
81 	switch (type) {
82 		case B_URL_PROTOCOL_DEBUG_TEXT:
83 			fprintf(stderr, "   ");
84 			break;
85 
86 		case B_URL_PROTOCOL_DEBUG_ERROR:
87 			fprintf(stderr, "!!!");
88 			break;
89 
90 		case B_URL_PROTOCOL_DEBUG_TRANSFER_IN:
91 		case B_URL_PROTOCOL_DEBUG_HEADER_IN:
92 			fprintf(stderr, "<--");
93 			break;
94 
95 		case B_URL_PROTOCOL_DEBUG_TRANSFER_OUT:
96 		case B_URL_PROTOCOL_DEBUG_HEADER_OUT:
97 			fprintf(stderr, "-->");
98 			break;
99 	}
100 
101 	fprintf(stderr, " %s: %s\n", caller->Protocol().String(), text);
102 #endif
103 }
104