xref: /haiku/headers/private/netservices/GopherRequest.h (revision 52c4471a3024d2eb81fe88e2c3982b9f8daa5e56)
1 /*
2  * Copyright 2014 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _B_GOPHER_REQUEST_H_
6 #define _B_GOPHER_REQUEST_H_
7 
8 
9 #include <deque>
10 
11 #include <NetworkRequest.h>
12 #include <UrlProtocolRoster.h>
13 
14 
15 namespace BPrivate {
16 
17 namespace Network {
18 
19 
20 class BGopherRequest : public BNetworkRequest {
21 public:
22 	virtual						~BGopherRequest();
23 
24 			status_t			Stop();
25 	const 	BUrlResult&			Result() const;
26             void                SetDisableListener(bool disable);
27 
28 private:
29 			friend class BUrlProtocolRoster;
30 
31 								BGopherRequest(const BUrl& url,
32 									BDataIO* output,
33 									BUrlProtocolListener* listener = NULL,
34 									BUrlContext* context = NULL);
35 
36 			status_t			_ProtocolLoop();
37 			void				_SendRequest();
38 
39 			bool				_NeedsParsing();
40 			bool				_NeedsLastDotStrip();
41 
42 			status_t			_ParseInput(bool last);
43 
44 			BString&			_HTMLEscapeString(BString &str);
45 
46 private:
47 			char				fItemType;
48 			BString				fPath;
49 
50 			ssize_t				fPosition;
51 
52 			BUrlResult			fResult;
53 };
54 
55 
56 } // namespace Network
57 
58 } // namespace BPrivate
59 
60 #endif // _B_GOPHER_REQUEST_H_
61