You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
4.1 KiB

  1. Author: Alexandre Rossi <alexandre.rossi@gmail.com>
  2. Description: Take into account libevhtp API changes
  3. Forwarded: no
  4. Index: seafile-server/server/upload-file.c
  5. ===================================================================
  6. --- seafile-server.orig/server/upload-file.c 2018-02-01 12:25:52.666911934 +0100
  7. +++ seafile-server/server/upload-file.c 2018-02-01 12:27:37.812323399 +0100
  8. @@ -2059,7 +2059,7 @@
  9. /* Set keepalive to 0. This will cause evhtp to close the
  10. * connection after sending the reply.
  11. */
  12. - req->keepalive = 0;
  13. + req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
  14. fsm->state = RECV_ERROR;
  15. }
  16. @@ -2260,8 +2260,8 @@
  17. }
  18. /* Set up per-request hooks, so that we can read file data piece by piece. */
  19. - evhtp_set_hook (&req->hooks, evhtp_hook_on_read, upload_read_cb, fsm);
  20. - evhtp_set_hook (&req->hooks, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
  21. + evhtp_request_set_hook (req, evhtp_hook_on_read, upload_read_cb, fsm);
  22. + evhtp_request_set_hook (req, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
  23. /* Set arg for upload_cb or update_cb. */
  24. req->cbarg = fsm;
  25. @@ -2277,7 +2277,7 @@
  26. /* Set keepalive to 0. This will cause evhtp to close the
  27. * connection after sending the reply.
  28. */
  29. - req->keepalive = 0;
  30. + req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
  31. send_error_reply (req, EVHTP_RES_BADREQ, err_msg);
  32. g_free (repo_id);
  33. @@ -2346,38 +2346,32 @@
  34. cb = evhtp_set_regex_cb (htp, "^/upload/.*", upload_cb, NULL);
  35. /* upload_headers_cb() will be called after evhtp parsed all http headers. */
  36. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  37. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  38. cb = evhtp_set_regex_cb (htp, "^/upload-api/.*", upload_api_cb, NULL);
  39. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  40. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  41. cb = evhtp_set_regex_cb (htp, "^/upload-raw-blks-api/.*",
  42. upload_raw_blks_api_cb, NULL);
  43. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  44. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  45. cb = evhtp_set_regex_cb (htp, "^/upload-blks-api/.*", upload_blks_api_cb, NULL);
  46. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  47. -
  48. - /* cb = evhtp_set_regex_cb (htp, "^/upload-blks-aj/.*", upload_blks_ajax_cb, NULL); */
  49. - /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
  50. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  51. cb = evhtp_set_regex_cb (htp, "^/upload-aj/.*", upload_ajax_cb, NULL);
  52. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  53. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  54. cb = evhtp_set_regex_cb (htp, "^/update/.*", update_cb, NULL);
  55. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  56. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  57. cb = evhtp_set_regex_cb (htp, "^/update-api/.*", update_api_cb, NULL);
  58. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  59. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  60. cb = evhtp_set_regex_cb (htp, "^/update-blks-api/.*", update_blks_api_cb, NULL);
  61. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  62. -
  63. - /* cb = evhtp_set_regex_cb (htp, "^/update-blks-aj/.*", update_blks_ajax_cb, NULL); */
  64. - /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
  65. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  66. cb = evhtp_set_regex_cb (htp, "^/update-aj/.*", update_ajax_cb, NULL);
  67. - evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
  68. + evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
  69. evhtp_set_regex_cb (htp, "^/upload_progress.*", upload_progress_cb, NULL);