From 7e3fbc499175e5d221b3788c6dde71d27fd164f6 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 24 Aug 2015 13:46:18 +0000 Subject: [PATCH] Pasta: fixed bug when there is no data on clipboard, use keep-alive connection. git-svn-id: svn://kolibrios.org@5770 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/pasta/pasta.asm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/programs/network/pasta/pasta.asm b/programs/network/pasta/pasta.asm index eef80bb0cf..b1edf08570 100644 --- a/programs/network/pasta/pasta.asm +++ b/programs/network/pasta/pasta.asm @@ -75,6 +75,8 @@ clipboard: mcall 54 cmp eax, -1 je error + cmp eax, 1 + je error ; Verify if we can work with it mov [clipboard_data], eax @@ -101,7 +103,7 @@ escape: pop [clipboard_data] ; Connect to the server - invoke HTTP_get, sz_url, 0, 0, 0 + invoke HTTP_get, sz_url, 0, FLAG_BLOCK or FLAG_KEEPALIVE, 0 test eax, eax jz error_free_clip mov [identifier], eax @@ -135,14 +137,11 @@ escape: xor al, al stosb - invoke HTTP_free, [identifier] - mov ecx, [clipboard_data_length] add ecx, sz_paste_head.length + sz_paste_tail.length - invoke HTTP_post, sz_url, 0, 0, sz_cookie, sz_ctype, ecx + invoke HTTP_post, sz_url, [identifier], FLAG_BLOCK, sz_cookie, sz_ctype, ecx test eax, eax - jz error_free_clip - mov [identifier], eax + jz error_free_clip_disconnect ; Send the data to the server mov ecx, [eax + http_msg.socket] @@ -158,6 +157,8 @@ escape: test eax, eax jnz .again2 + invoke HTTP_disconnect, [identifier] + mov ebp, [identifier] cmp [ebp + http_msg.status], 302 ; found jne error_free_http @@ -205,6 +206,9 @@ escape: error_free_http: invoke HTTP_free, [identifier] jmp error +error_free_clip_disconnect: + invoke HTTP_disconnect, [identifier] + invoke HTTP_free, [identifier] error_free_clip: mcall 68, 13, [clipboard_data] error: @@ -228,7 +232,8 @@ import lib_http, \ HTTP_receive, 'receive', \ HTTP_find_header_field, 'find_header_field', \ HTTP_free, 'free', \ - HTTP_escape, 'escape' + HTTP_escape, 'escape', \ + HTTP_disconnect, 'disconnect' IM_END: