345 |
| _ -> |
| _ -> |
346 |
let tmpfile = Filename.temp_file "http_" "" in |
let tmpfile = Filename.temp_file "http_" "" in |
347 |
if !debug then begin |
if !debug then begin |
348 |
lprintf "WARNING: saving to file %s" tmpfile; lprint_newline (); |
lprintf "WARNING: saving to file %s\n" tmpfile; |
349 |
end; |
end; |
350 |
let oc = open_out tmpfile in |
let oc = open_out tmpfile in |
351 |
let rec iter n empty_line = |
let rec iter n empty_line = |
394 |
end; |
end; |
395 |
raise Exit |
raise Exit |
396 |
| [] -> |
| [] -> |
397 |
if !debug then begin |
if !debug then lprintf "NO LINES\n"; |
|
lprintf "NO LINES"; lprint_newline (); |
|
|
end; |
|
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 |
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"; lprint_newline (); |
lprintf "CALL HANDLR\n"; |
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 |
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" len b.rlen; lprint_newline (); |
lprintf "check_len: len %d rlen %d\n" 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" len buf.rlen; lprint_newline (); |
lprintf "check_len: len %d rlen %d\n" 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 |
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)" file (Printexc2.to_string e); |
lprintf "No such file: %s (%s)\n" file (Printexc2.to_string e); |
|
lprint_newline (); |
|
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 |
*) |
*) |