http_ex.h 788 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "http.h"
  3. #include <library/cpp/http/misc/httpreqdata.h>
  4. class THttpClientRequestExtension: public TClientRequest {
  5. public:
  6. bool Parse(char* req, TBaseServerRequestData& rd);
  7. bool ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData);
  8. protected:
  9. virtual bool OptionsAllowed() {
  10. return false;
  11. }
  12. };
  13. template <class TRequestData>
  14. class THttpClientRequestExtImpl: public THttpClientRequestExtension {
  15. protected:
  16. bool Parse(char* req) {
  17. return THttpClientRequestExtension::Parse(req, RD);
  18. }
  19. bool ProcessHeaders() {
  20. return THttpClientRequestExtension::ProcessHeaders(RD, Buf);
  21. }
  22. protected:
  23. TRequestData RD;
  24. TBlob Buf;
  25. };
  26. using THttpClientRequestEx = THttpClientRequestExtImpl<TServerRequestData>;