Subversion Repositories Kolibri OS

Rev

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

Rev 4221 Rev 4222
Line 198... Line 198...
198
        rep     movsb
198
        rep     movsb
Line 199... Line 199...
199
 
199
 
200
        mov     byte[edi], 0
200
        mov     byte[edi], 0
Line -... Line 201...
-
 
201
        DEBUGF  1, "Request:\n%s", [buffer]
-
 
202
 
-
 
203
; Free unused memory
-
 
204
        push    edi
-
 
205
        invoke  mem.free, [pageaddr]
-
 
206
        invoke  mem.free, [hostname]
201
        DEBUGF  1, "Request:\n%s", [buffer]
207
        pop     esi
202
 
-
 
203
; Send the request
208
 
204
        mov     esi, edi
209
; Send the request
205
        sub     esi, [buffer]   ; length
-
 
206
        xor     edi, edi        ; flags
210
        sub     esi, [buffer]   ; length
207
 
211
        xor     edi, edi        ; flags
208
        mcall   send, [socketnum], [buffer]
212
        mcall   send, [socketnum], [buffer]
209
        test    eax, eax
213
        test    eax, eax
Line 301... Line 305...
301
        rep     movsb
305
        rep     movsb
Line 302... Line 306...
302
 
306
 
303
        mov     byte[edi], 0
307
        mov     byte[edi], 0
Line -... Line 308...
-
 
308
        DEBUGF  1, "Request:\n%s", [buffer]
-
 
309
 
-
 
310
 
-
 
311
; Free unused memory
-
 
312
        push    edi
-
 
313
        invoke  mem.free, [pageaddr]
-
 
314
        invoke  mem.free, [hostname]
304
        DEBUGF  1, "Request:\n%s", [buffer]
315
        pop     esi
305
 
-
 
306
; Send the request
316
 
307
        mov     esi, edi
317
; Send the request
308
        sub     esi, [buffer]   ; length
-
 
309
        xor     edi, edi        ; flags
318
        sub     esi, [buffer]   ; length
310
 
319
        xor     edi, edi        ; flags
311
        mcall   send, [socketnum], [buffer]
320
        mcall   send, [socketnum], [buffer]
312
        test    eax, eax
321
        test    eax, eax
Line 419... Line 428...
419
        rep     movsb
428
        rep     movsb
Line 420... Line 429...
420
 
429
 
421
        mov     byte[edi], 0
430
        mov     byte[edi], 0
Line -... Line 431...
-
 
431
        DEBUGF  1, "Request:\n%s", [buffer]
-
 
432
 
-
 
433
; Free unused memory
-
 
434
        push    edi
-
 
435
        invoke  mem.free, [pageaddr]
-
 
436
        invoke  mem.free, [hostname]
422
        DEBUGF  1, "Request:\n%s", [buffer]
437
        pop     esi
423
 
-
 
424
; Send the request
438
 
425
        mov     esi, edi
439
; Send the request
426
        sub     esi, [buffer]   ; length
440
        sub     esi, [buffer]   ; length
427
        xor     edi, edi        ; flags
441
        xor     edi, edi        ; flags
428
        mcall   send, [socketnum], [buffer]
442
        mcall   send, [socketnum], [buffer]
Line 598... Line 612...
598
        mov     byte[esi-1], 0
612
        mov     byte[esi-1], 0
599
        lea     esi, [ebp + http_msg.data]
613
        lea     esi, [ebp + http_msg.data]
600
        DEBUGF  1, "Header names converted to lowercase:\n%s\n", esi
614
        DEBUGF  1, "Header names converted to lowercase:\n%s\n", esi
Line 601... Line 615...
601
 
615
 
602
; Check for content-length header field.
616
; Check for content-length header field.
603
        stdcall find_header_field, ebp, str_cl
617
        stdcall HTTP_find_header_field, ebp, str_cl
604
        test    eax, eax
618
        test    eax, eax
605
        jz      .no_content
619
        jz      .no_content
Line 606... Line 620...
606
        or      [ebp + http_msg.flags], FLAG_CONTENT_LENGTH
620
        or      [ebp + http_msg.flags], FLAG_CONTENT_LENGTH
Line 650... Line 664...
650
  .no_content:
664
  .no_content:
651
        DEBUGF  1, "Content-length not found.\n"
665
        DEBUGF  1, "Content-length not found.\n"
Line 652... Line 666...
652
 
666
 
653
; We didnt find 'content-length', maybe server is using chunked transfer encoding?
667
; We didnt find 'content-length', maybe server is using chunked transfer encoding?
654
; Try to find 'transfer-encoding' header.
668
; Try to find 'transfer-encoding' header.
655
        stdcall find_header_field, ebp, str_te
669
        stdcall HTTP_find_header_field, ebp, str_te
656
        test    eax, eax
670
        test    eax, eax
Line 657... Line 671...
657
        jz      .not_chunked
671
        jz      .not_chunked
658
 
672
 
Line 892... Line 906...
892
endp
906
endp
Line 893... Line 907...
893
 
907
 
894
 
908
 
895
 
909
 
896
;;================================================================================================;;
910
;;================================================================================================;;
897
proc find_header_field identifier, headername ;///////////////////////////////////////////////////;;
911
proc HTTP_find_header_field identifier, headername ;//////////////////////////////////////////////;;
898
;;------------------------------------------------------------------------------------------------;;
912
;;------------------------------------------------------------------------------------------------;;
899
;? Find a header field in the received HTTP header                                                ;;
913
;? Find a header field in the received HTTP header                                                ;;
Line 1249... Line 1263...
1249
        dec     edi                     ; return one char, '/' must be part of the pageaddr
1263
        dec     edi                     ; return one char, '/' must be part of the pageaddr
1250
        inc     ecx                     ;
1264
        inc     ecx                     ;
1251
  @@:
1265
  @@:
1252
        push    ecx edi                 ; remember the pointer and length of pageaddr
1266
        push    ecx edi                 ; remember the pointer and length of pageaddr
Line -... Line 1267...
-
 
1267
 
-
 
1268
 
1253
 
1269
; Create new buffer and put hostname in it
1254
        mov     ecx, edi
1270
        mov     ecx, edi
1255
        sub     ecx, [URL]
1271
        sub     ecx, [URL]
1256
        inc     ecx                     ; we will add a 0 byte at the end
1272
        inc     ecx                     ; we will add a 0 byte at the end
1257
        invoke  mem.alloc, ecx
1273
        invoke  mem.alloc, ecx
Line 1374... Line 1390...
1374
        lib_init                , 'lib_init'            , \
1390
        lib_init                , 'lib_init'            , \
1375
        0x00010001              , 'version'             , \
1391
        0x00010001              , 'version'             , \
1376
        HTTP_get                , 'get'                 , \
1392
        HTTP_get                , 'get'                 , \
1377
        HTTP_head               , 'head'                , \
1393
        HTTP_head               , 'head'                , \
1378
        HTTP_post               , 'post'                , \
1394
        HTTP_post               , 'post'                , \
1379
        find_header_field       , 'find_header_field'   , \
1395
        HTTP_find_header_field  , 'find_header_field'   , \
1380
        HTTP_process            , 'process'             , \
1396
        HTTP_process            , 'process'             , \
1381
        HTTP_free               , 'free'                , \
1397
        HTTP_free               , 'free'                , \
1382
        HTTP_stop               , 'stop'                , \
1398
        HTTP_stop               , 'stop'                , \
1383
        URI_escape              , 'escape'              , \
1399
        URI_escape              , 'escape'              , \
1384
        URI_unescape            , 'unescape'
1400
        URI_unescape            , 'unescape'