Subversion Repositories Kolibri OS

Rev

Rev 5732 | Rev 5904 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5732 Rev 5769
Line 143... Line 143...
143
 
143
 
144
        popa
144
        popa
Line 145... Line 145...
145
        ret
145
        ret
146
 
146
 
147
  .error:
147
  .error:
148
        DEBUGF  2, "Cant close already closed connection!\n"
148
        DEBUGF  1, "Cant close already closed connection!\n"
Line 149... Line 149...
149
        popa
149
        popa
Line 297... Line 297...
297
        test    eax, eax
297
        test    eax, eax
298
        jz      .error
298
        jz      .error
299
        DEBUGF  1, "Request has been sent to server.\n"
299
        DEBUGF  1, "Request has been sent to server.\n"
Line 300... Line 300...
300
 
300
 
301
        cmp     [identifier], 0
301
        cmp     [identifier], 0
-
 
302
        je      .new_connection
-
 
303
        invoke  mem.free, [buffer]
-
 
304
        mov     eax, [identifier]
-
 
305
        mov     [buffer], eax
302
        jne     .old_connection
306
  .new_connection:
303
        HTTP_init_buffer [buffer], [socketnum], [flags]
-
 
304
 
307
        HTTP_init_buffer [buffer], [socketnum], [flags]
305
        popa
308
        popa
306
        mov     eax, [buffer]   ; return buffer ptr
309
        mov     eax, [buffer]   ; return buffer ptr
Line 307... Line -...
307
        ret
-
 
308
 
-
 
309
  .old_connection:
-
 
310
        invoke  mem.free, [buffer]
-
 
311
        popa
-
 
312
        mov     eax, [identifier]
-
 
313
        ret
310
        ret
314
 
311
 
315
  .error:
312
  .error:
316
        DEBUGF  2, "HTTP GET error!\n"
313
        DEBUGF  2, "HTTP GET error!\n"
317
        popa
314
        popa
Line 439... Line 436...
439
        test    eax, eax
436
        test    eax, eax
440
        jz      .error
437
        jz      .error
441
        DEBUGF  1, "Request has been sent to server.\n"
438
        DEBUGF  1, "Request has been sent to server.\n"
Line 442... Line 439...
442
 
439
 
443
        cmp     [identifier], 0
440
        cmp     [identifier], 0
-
 
441
        je      .new_connection
-
 
442
        invoke  mem.free, [buffer]
-
 
443
        mov     eax, [identifier]
-
 
444
        mov     [buffer], eax
444
        jne     .old_connection
445
  .new_connection:
445
        HTTP_init_buffer [buffer], [socketnum], [flags]
-
 
446
 
446
        HTTP_init_buffer [buffer], [socketnum], [flags]
447
        popa
447
        popa
448
        mov     eax, [buffer]   ; return buffer ptr
448
        mov     eax, [buffer]   ; return buffer ptr
Line 449... Line -...
449
        ret
-
 
450
 
-
 
451
  .old_connection:
-
 
452
        invoke  mem.free, [buffer]
-
 
453
        popa
-
 
454
        mov     eax, [identifier]
-
 
455
        ret
449
        ret
456
 
450
 
457
  .error:
451
  .error:
458
        DEBUGF  2, "HTTP HEAD error!\n"
452
        DEBUGF  2, "HTTP HEAD error!\n"
459
        popa
453
        popa
Line 596... Line 590...
596
        test    eax, eax
590
        test    eax, eax
597
        jz      .error
591
        jz      .error
598
        DEBUGF  1, "Request has been sent to server.\n"
592
        DEBUGF  1, "Request has been sent to server.\n"
Line 599... Line 593...
599
 
593
 
600
        cmp     [identifier], 0
594
        cmp     [identifier], 0
601
        jne     .old_connection
-
 
602
        HTTP_init_buffer [buffer], [socketnum], [flags]
-
 
603
 
-
 
604
        popa
-
 
605
        mov     eax, [buffer]   ; return buffer ptr
-
 
606
        ret
-
 
607
 
-
 
608
  .old_connection:
595
        je      .new_connection
609
        invoke  mem.free, [buffer]
-
 
610
        mov     ebx, [flags]
596
        invoke  mem.free, [buffer]
611
        mov     eax, [identifier]
597
        mov     eax, [identifier]
-
 
598
        mov     [buffer], eax
-
 
599
  .new_connection:
612
        or      [eax + http_msg.flags], ebx
600
        HTTP_init_buffer [buffer], [socketnum], [flags]
613
        popa
601
        popa
614
        mov     eax, [identifier]
602
        mov     eax, [buffer]   ; return buffer ptr
Line 615... Line 603...
615
        ret
603
        ret
616
 
604
 
617
  .error:
605
  .error:
Line 1053... Line 1041...
1053
        mov     [ebp + http_msg.content_length], eax
1041
        mov     [ebp + http_msg.content_length], eax
1054
        mov     [ebp + http_msg.content_received], eax
1042
        mov     [ebp + http_msg.content_received], eax
1055
  .got_all_data:
1043
  .got_all_data:
1056
        DEBUGF  1, "We got all the data! (%u bytes)\n", [ebp + http_msg.content_received]
1044
        DEBUGF  1, "We got all the data! (%u bytes)\n", [ebp + http_msg.content_received]
1057
        or      [ebp + http_msg.flags], FLAG_GOT_ALL_DATA
1045
        or      [ebp + http_msg.flags], FLAG_GOT_ALL_DATA
1058
        and     [ebp + http_msg.flags], not FLAG_CONNECTED
1046
        test    [ebp + http_msg.flags], FLAG_KEEPALIVE
-
 
1047
        jnz     @f
1059
        mcall   close, [ebp + http_msg.socket]
1048
        mcall   close, [ebp + http_msg.socket]
-
 
1049
        and     [ebp + http_msg.flags], not FLAG_CONNECTED
-
 
1050
  @@:
1060
        popa
1051
        popa
1061
        xor     eax, eax
1052
        xor     eax, eax
1062
        ret
1053
        ret
Line 1063... Line 1054...
1063
 
1054
 
Line 1899... Line 1890...
1899
str_proxy_auth  db 13, 10, 'Proxy-Authorization: Basic '
1890
str_proxy_auth  db 13, 10, 'Proxy-Authorization: Basic '
1900
  .length       = $ - str_proxy_auth
1891
  .length       = $ - str_proxy_auth
1901
str_close       db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Close', 13, 10, 13, 10
1892
str_close       db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Close', 13, 10, 13, 10
1902
  .length       = $ - str_close
1893
  .length       = $ - str_close
1903
str_keep        db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Keepalive', 13, 10, 13, 10
1894
str_keep        db 'User-Agent: KolibriOS libHTTP/1.1', 13, 10, 'Connection: Keepalive', 13, 10, 13, 10
1904
  .length       = $ - str_close
1895
  .length       = $ - str_keep
Line 1905... Line 1896...
1905
 
1896
 
Line 1906... Line 1897...
1906
str_http        db 'http://', 0
1897
str_http        db 'http://', 0
1907
 
1898