httpclient.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _HTTPCLIENT_HPP__
  14. #define _HTTPCLIENT_HPP__
  15. #include "esphttp.hpp"
  16. #include "soapesp.hpp"
  17. #define HTTP_CLIENT_DEFAULT_CONNECT_TIMEOUT 3000
  18. interface IHttpClient : extends ITransportClient
  19. {
  20. virtual void setProxy(const char* proxy) = 0;
  21. virtual void setUserID(const char* userid) = 0;
  22. virtual void setPassword(const char* password) = 0;
  23. virtual void setRealm(const char* realm) = 0;
  24. virtual void setConnectTimeOutMs(unsigned timeout) = 0;
  25. virtual void setTimeOut(unsigned int timeout) = 0;
  26. virtual void disableKeepAlive() = 0;
  27. virtual int sendRequest(const char* method, const char* contenttype, StringBuffer& request, StringBuffer& response) = 0;
  28. virtual int sendRequest(const char* method, const char* contenttype, StringBuffer& request, StringBuffer& response, StringBuffer& responseStatus, bool alwaysReadContent = false) = 0;
  29. virtual int sendRequest(IProperties *headers, const char* method, const char* contenttype, StringBuffer& content, StringBuffer &response, StringBuffer& responseStatus, bool alwaysReadContent = false) = 0;
  30. virtual int proxyRequest(IHttpMessage *request, IHttpMessage *response) = 0;
  31. virtual int postRequest(ISoapMessage & request, ISoapMessage & response) = 0;
  32. };
  33. interface IHttpClientContext : extends IInterface
  34. {
  35. virtual IHttpClient* createHttpClient(const char* proxy, const char* url) = 0;
  36. };
  37. esp_http_decl IHttpClientContext* getHttpClientContext();
  38. esp_http_decl IHttpClientContext* createHttpClientContext(IPropertyTree* config);
  39. #endif