mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-13 14:30:31 -05:00
catch exception in search_forward and string_match
This commit is contained in:
parent
da99ea70a9
commit
6eef2bbb01
1 changed files with 16 additions and 8 deletions
|
|
@ -191,18 +191,26 @@ let read_groups str groups cont =
|
|||
let search_forward regexp_ str ?(from=0) groups cont =
|
||||
let open Str in
|
||||
Mutex.lock str_mutex;
|
||||
try
|
||||
let _ = search_forward regexp_ str from in
|
||||
let cont = read_groups str groups cont in
|
||||
Mutex.unlock str_mutex;
|
||||
cont
|
||||
with e ->
|
||||
Mutex.unlock str_mutex;
|
||||
raise e
|
||||
|
||||
let string_match regexp_ str ?(from=0) groups cont =
|
||||
let open Str in
|
||||
Mutex.lock str_mutex;
|
||||
try
|
||||
let _ = string_match regexp_ str from in
|
||||
let cont = read_groups str groups cont in
|
||||
Mutex.unlock str_mutex;
|
||||
cont
|
||||
with e ->
|
||||
Mutex.unlock str_mutex;
|
||||
raise e
|
||||
|
||||
let first_line str =
|
||||
let pos = String.index str '\n' in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue