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