[Groonga-commit] groonga/groonga at 2f63a2f [master] groonga: fix returning wrong result after unfinished /d/load data by POST

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jul 25 12:56:20 JST 2018


Kouhei Sutou	2018-07-25 12:56:20 +0900 (Wed, 25 Jul 2018)

  New Revision: 2f63a2fdfe1bbd76b1907818f718dd0523e51013
  https://github.com/groonga/groonga/commit/2f63a2fdfe1bbd76b1907818f718dd0523e51013

  Message:
    groonga: fix returning wrong result after unfinished /d/load data by POST
    
    GitHub: fix #860

  Modified files:
    src/groonga.c

  Modified: src/groonga.c (+5 -3)
===================================================================
--- src/groonga.c    2018-07-25 12:37:29 +0900 (462832ad7)
+++ src/groonga.c    2018-07-25 12:56:20 +0900 (3a512f549)
@@ -1575,6 +1575,7 @@ do_htreq_post(grn_ctx *ctx, ht_context *hc)
   }
 
   {
+    grn_bool is_tail_sent = GRN_FALSE;
     grn_obj chunk_buffer;
     long long int read_content_length = 0;
 
@@ -1631,6 +1632,7 @@ do_htreq_post(grn_ctx *ctx, ht_context *hc)
             flags |= GRN_CTX_MORE;
           } else {
             flags |= GRN_CTX_TAIL;
+            is_tail_sent = GRN_TRUE;
           }
           grn_ctx_send(ctx,
                        GRN_TEXT_VALUE(&chunk_buffer),
@@ -1652,13 +1654,13 @@ do_htreq_post(grn_ctx *ctx, ht_context *hc)
       }
     }
 
-    if (ctx->rc == GRN_CANCEL) {
-      h_output(ctx, GRN_CTX_TAIL, hc);
-    } else if (ctx->rc == GRN_SUCCESS && GRN_TEXT_LEN(&chunk_buffer) > 0) {
+    if (ctx->rc == GRN_SUCCESS && GRN_TEXT_LEN(&chunk_buffer) > 0) {
       grn_ctx_send(ctx,
                    GRN_TEXT_VALUE(&chunk_buffer),
                    GRN_TEXT_LEN(&chunk_buffer),
                    GRN_CTX_TAIL);
+    } else if (!is_tail_sent) {
+      grn_ctx_send(ctx, NULL, 0, GRN_CTX_TAIL);
     }
 
     GRN_OBJ_FIN(ctx, &chunk_buffer);
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180725/02e38653/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index