~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to src/netstring/netmime.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(* $Id: netmime.ml 1003 2006-09-24 15:17:15Z gerd $
 
1
(* $Id: netmime.ml 1588 2011-04-28 13:59:54Z gerd $
2
2
 * ----------------------------------------------------------------------
3
3
 *
4
4
 *)
238
238
end
239
239
 
240
240
 
241
 
let drop_ws_re = Netstring_pcre.regexp "^[ \t\r\n]*(.*[^ \t\r\n])[ \t\r\n]*$";;
 
241
let drop_ws_re = 
 
242
  Netstring_str.regexp "^[ \t\r\n]*\\(.*[^ \t\r\n]\\)[ \t\r\n]*$";;
242
243
 
243
244
let drop_ws s =
244
245
  (* Deletes whitespace at the beginning and at the end of s, and returns
245
246
   * the new string
246
247
   *)
247
 
  match Netstring_pcre.string_match drop_ws_re s 0 with
 
248
  match Netstring_str.string_match drop_ws_re s 0 with
248
249
      None -> ""
249
 
    | Some r -> Netstring_pcre.matched_group r 1 s
 
250
    | Some r -> Netstring_str.matched_group r 1 s
250
251
;;
251
252
  
252
253
 
747
748
              with
748
749
                  Not_found as ex -> raise ex  (* falls through to next [try] *)
749
750
                | ex ->
750
 
                    failwith ("Netmime.write_mime_message: Cannot parse content-type field: " ^ Printexc.to_string ex)
 
751
                    failwith ("Netmime.write_mime_message: Cannot parse content-type field: " ^ Netexn.to_string ex)
751
752
            in  
752
753
            if String.length ctype < 10 || String.sub ctype 0 10 <> "multipart/"
753
754
            then