llcorehttpopcancel.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @file llcorehttpopcancel.cpp
  3. * @brief Definitions for internal class HttpOpCancel
  4. *
  5. * $LicenseInfo:firstyear=2012&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2012, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "linden_common.h"
  27. #include "curl/curl.h"
  28. #include "llcorehttpopcancel.h"
  29. #include "llcorehttphandler.h"
  30. #include "llcorehttpresponse.h"
  31. #include "llcorehttpservice.h"
  32. namespace LLCore
  33. {
  34. HttpOpCancel::HttpOpCancel(HttpHandle handle)
  35. : HttpOperation(),
  36. mHandle(handle)
  37. {
  38. }
  39. // Immediately searches for the request on various queues and cancels
  40. // operations if found. Returns the status of the search and cancel as the
  41. // status of this request. The cancelled request will return a cancelled status
  42. // to its handler.
  43. void HttpOpCancel::stageFromRequest(HttpService* service)
  44. {
  45. if (!service || !service->cancel(mHandle))
  46. {
  47. mStatus = HttpStatus(HttpStatus::LLCORE, HE_HANDLE_NOT_FOUND);
  48. }
  49. addAsReply();
  50. }
  51. } // End namespace LLCore