1603e0bdfSNiels Sascha Reedijk /* 2603e0bdfSNiels Sascha Reedijk * Copyright 2014 Haiku Inc. All rights reserved. 3603e0bdfSNiels Sascha Reedijk * Distributed under the terms of the MIT License. 4603e0bdfSNiels Sascha Reedijk */ 5603e0bdfSNiels Sascha Reedijk #ifndef _B_GOPHER_REQUEST_H_ 6603e0bdfSNiels Sascha Reedijk #define _B_GOPHER_REQUEST_H_ 7603e0bdfSNiels Sascha Reedijk 8603e0bdfSNiels Sascha Reedijk 9603e0bdfSNiels Sascha Reedijk #include <deque> 10603e0bdfSNiels Sascha Reedijk 11603e0bdfSNiels Sascha Reedijk #include <NetworkRequest.h> 12603e0bdfSNiels Sascha Reedijk #include <UrlProtocolRoster.h> 13603e0bdfSNiels Sascha Reedijk 14603e0bdfSNiels Sascha Reedijk 15ce64ffdbSNiels Sascha Reedijk namespace BPrivate { 16ce64ffdbSNiels Sascha Reedijk 17ce64ffdbSNiels Sascha Reedijk namespace Network { 18*70b63f18SNiels Sascha Reedijk 19ce64ffdbSNiels Sascha Reedijk 20603e0bdfSNiels Sascha Reedijk class BGopherRequest : public BNetworkRequest { 21603e0bdfSNiels Sascha Reedijk public: 22603e0bdfSNiels Sascha Reedijk virtual ~BGopherRequest(); 23603e0bdfSNiels Sascha Reedijk 24603e0bdfSNiels Sascha Reedijk status_t Stop(); 25603e0bdfSNiels Sascha Reedijk const BUrlResult& Result() const; 26603e0bdfSNiels Sascha Reedijk void SetDisableListener(bool disable); 27603e0bdfSNiels Sascha Reedijk 28603e0bdfSNiels Sascha Reedijk private: 29603e0bdfSNiels Sascha Reedijk friend class BUrlProtocolRoster; 30603e0bdfSNiels Sascha Reedijk 3178b14420SLeorize BGopherRequest(const BUrl& url, 3278b14420SLeorize BDataIO* output, 3378b14420SLeorize BUrlProtocolListener* listener = NULL, 3478b14420SLeorize BUrlContext* context = NULL); 35603e0bdfSNiels Sascha Reedijk 36603e0bdfSNiels Sascha Reedijk status_t _ProtocolLoop(); 37603e0bdfSNiels Sascha Reedijk void _SendRequest(); 38603e0bdfSNiels Sascha Reedijk 39603e0bdfSNiels Sascha Reedijk bool _NeedsParsing(); 40603e0bdfSNiels Sascha Reedijk bool _NeedsLastDotStrip(); 41*70b63f18SNiels Sascha Reedijk 4278b14420SLeorize status_t _ParseInput(bool last); 43603e0bdfSNiels Sascha Reedijk 44603e0bdfSNiels Sascha Reedijk BString& _HTMLEscapeString(BString &str); 45603e0bdfSNiels Sascha Reedijk 46603e0bdfSNiels Sascha Reedijk private: 47603e0bdfSNiels Sascha Reedijk char fItemType; 48603e0bdfSNiels Sascha Reedijk BString fPath; 49603e0bdfSNiels Sascha Reedijk 50603e0bdfSNiels Sascha Reedijk ssize_t fPosition; 51603e0bdfSNiels Sascha Reedijk 52603e0bdfSNiels Sascha Reedijk BUrlResult fResult; 53603e0bdfSNiels Sascha Reedijk }; 54603e0bdfSNiels Sascha Reedijk 55*70b63f18SNiels Sascha Reedijk 56ce64ffdbSNiels Sascha Reedijk } // namespace Network 57ce64ffdbSNiels Sascha Reedijk 58ce64ffdbSNiels Sascha Reedijk } // namespace BPrivate 59603e0bdfSNiels Sascha Reedijk 60603e0bdfSNiels Sascha Reedijk #endif // _B_GOPHER_REQUEST_H_ 61