/[mldonkey]/mldonkey/src/utils/net/http_server.ml
ViewVC logotype

Diff of /mldonkey/src/utils/net/http_server.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by spiralvoice, Mon Jun 20 18:38:49 2005 UTC revision 1.14 by spiralvoice, Thu Jul 7 00:25:46 2005 UTC
# Line 249  let parse_head sock s = Line 249  let parse_head sock s =
249                | _ -> options                | _ -> options
250              with e ->              with e ->
251                  if !debug then begin                  if !debug then begin
252                      lprintf "Exception %s in header %s\n"                      lprintf_nl "[HTTPSRV]: Exception %s in header %s"
253                        (Printexc2.to_string e) name;                        (Printexc2.to_string e) name;
254                    end;                    end;
255                  options                  options
# Line 390  let complete_multipart_data request ic t Line 390  let complete_multipart_data request ic t
390                lprintf "ILL FORMED LINE: [%s]" name;                lprintf "ILL FORMED LINE: [%s]" name;
391                List.iter (fun (name, v) ->                List.iter (fun (name, v) ->
392                    lprintf " (%s,%s)" name v) args;                    lprintf " (%s,%s)" name v) args;
393                lprint_newline ();                lprint_nl "";
394              end;              end;
395            raise Exit            raise Exit
396        | [] ->        | [] ->
397            if !debug then lprintf "NO LINES\n";            if !debug then lprintf_nl "NO LINES";
398            raise Exit            raise Exit
399      in      in
400      if !end_boundary_found then field :: previous else      if !end_boundary_found then field :: previous else
# Line 406  let complete_multipart_data request ic t Line 406  let complete_multipart_data request ic t
406    
407  let parse_post_args f len req b =  let parse_post_args f len req b =
408  (* parse post args *)  (* parse post args *)
409    lprintf "CALL HANDLR\n";    lprintf_nl "CALL HANDLER";
410    let s = String.sub b.rbuf b.rpos len in    let s = String.sub b.rbuf b.rpos len in
411    Select.buf_used b len;    Select.buf_used b len;
412    let args = Url.cut_args s in    let args = Url.cut_args s in
# Line 415  let parse_post_args f len req b = Line 415  let parse_post_args f len req b =
415    f b req    f b req
416        
417  let check_len f len b pos2 =  let check_len f len b pos2 =
418    lprintf "check_len: len %d rlen %d\n" len b.rlen;    lprintf_nl "check_len: len %d rlen %d" len b.rlen;
419    if b.rlen >= len then f b    if b.rlen >= len then f b
420    
421  let complete_post_request ( f : handler ) buf request =  let complete_post_request ( f : handler ) buf request =
422    let len = request.options.content_length in    let len = request.options.content_length in
423    lprintf "check_len: len %d rlen %d\n" len buf.rlen;    lprintf_nl "check_len: len %d rlen %d" len buf.rlen;
424    if buf.rlen >= len then    if buf.rlen >= len then
425      parse_post_args f len request buf      parse_post_args f len request buf
426    else    else
# Line 635  let give_doc buf request = Line 635  let give_doc buf request =
635      stream_out_string buf ans;      stream_out_string buf ans;
636      at_write_end buf.fd_task shutdown;      at_write_end buf.fd_task shutdown;
637    with e ->    with e ->
638        lprintf "No such file: %s (%s)\n" file (Printexc2.to_string e);        lprintf_nl "[HTTPSRV]: No such file: %s (%s)" file (Printexc2.to_string e);
639        simple_error_404 buf;        simple_error_404 buf;
640        at_write_end buf.fd_task shutdown        at_write_end buf.fd_task shutdown
641  *)        *)      
# Line 797  let handler config t event = Line 797  let handler config t event =
797          TcpBufferedSocket.set_closer sock request_closer;          TcpBufferedSocket.set_closer sock request_closer;
798          TcpBufferedSocket.set_handler sock TcpBufferedSocket.BUFFER_OVERFLOW          TcpBufferedSocket.set_handler sock TcpBufferedSocket.BUFFER_OVERFLOW
799            (fun _ -> TcpBufferedSocket.close sock Closed_for_overflow;            (fun _ -> TcpBufferedSocket.close sock Closed_for_overflow;
800                 lprintf "BUFFER OVERFLOW\n" );  ()                 lprintf_nl "[HTTPSRV]: BUFFER OVERFLOW" );  ()
801        else        else
802          Unix.close s          Unix.close s
803    | _ -> ()    | _ -> ()
# Line 854  let parse_range range = Line 854  let parse_range range =
854      x, Some y, Some z      x, Some y, Some z
855    with    with
856    | e ->    | e ->
857        lprintf "Exception %s for range [%s]\n"        lprintf_nl "[HTTPSRV]: Exception %s for range [%s]"
858          (Printexc2.to_string e) range;          (Printexc2.to_string e) range;
859        raise e        raise e
860    
# Line 872  open Int64ops Line 872  open Int64ops
872  (*  Range: bytes=31371876- *)  (*  Range: bytes=31371876- *)
873  let request_range r =  let request_range r =
874    List.iter (fun (h, v1) ->    List.iter (fun (h, v1) ->
875        lprintf "HEADER [%s] = [%s]\n" h v1        lprintf_nl "[HTTPSRV]: HEADER [%s] = [%s]" h v1
876    ) r.headers;    ) r.headers;
877    let range = List.assoc "Range" r.headers in    let range = List.assoc "Range" r.headers in
878    match parse_range range with    match parse_range range with
# Line 884  let request_range r = Line 884  let request_range r =
884          x, Some (y ++ Int64.one)          x, Some (y ++ Int64.one)
885    | x, Some y, None ->    | x, Some y, None ->
886        x, Some (y ++ Int64.one)        x, Some (y ++ Int64.one)
         
887          

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26