Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

270 lines (238 sloc) 9.485 kb
(*
Copyright © 2011 MLstate
This file is part of OPA.
OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.
OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
(* Generated by mkrp.ml - Wed, 15 Dec 2010 12:31:00 GMT *)
open Requestdef
open RequestType
exception ParseFail_hdr of int
let hdr_scmp s1 s2 m n =
let p = ref m in
while !p < n && Char.lowercase (String.unsafe_get s1 (!p)) = Char.lowercase (String.unsafe_get s2 (!p)) do incr p done;
!p = n
let hdr_fail (_:string -> int -> int -> [`string of string | `value of (string * string option) list] RequestHeader.t -> int -> request_header -> [`string of string | `value of (string * string option) list] RequestHeader.t) (_hdr:string) (_hdrlen:int) (nxt:int) (_rh:[`string of string | `value of (string * string option) list] RequestHeader.t) = raise (ParseFail_hdr nxt)
let hdr_tab = Array.init 55 (fun _ -> Array.make 56 hdr_fail)
let hdrAc rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Accept-Encoding" 2 15
then rpfn hdr hdrlen nxt rh 15 `Accept_Encoding
else if hdr_scmp hdr "Accept-Language" 2 15
then rpfn hdr hdrlen nxt rh 15 `Accept_Language
else if hdr_scmp hdr "Accept-Charset" 2 14
then rpfn hdr hdrlen nxt rh 14 `Accept_Charset
else if hdr_scmp hdr "Accept" 2 6
then rpfn hdr hdrlen nxt rh 6 `Accept
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(0).(2) <- hdrAc
let _ = hdr_tab.(32).(2) <- hdrAc
let _ = hdr_tab.(0).(34) <- hdrAc
let _ = hdr_tab.(32).(34) <- hdrAc
let hdrAl rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Allow" 2 5
then rpfn hdr hdrlen nxt rh 5 `Allow
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(0).(11) <- hdrAl
let _ = hdr_tab.(32).(11) <- hdrAl
let _ = hdr_tab.(0).(43) <- hdrAl
let _ = hdr_tab.(32).(43) <- hdrAl
let hdrAu rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Authorization" 2 13
then rpfn hdr hdrlen nxt rh 13 `Authorization
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(0).(20) <- hdrAu
let _ = hdr_tab.(32).(20) <- hdrAu
let _ = hdr_tab.(0).(52) <- hdrAu
let _ = hdr_tab.(32).(52) <- hdrAu
let hdrCa rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Cache-Control" 2 13
then rpfn hdr hdrlen nxt rh 13 `Cache_Control
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(2).(0) <- hdrCa
let _ = hdr_tab.(34).(0) <- hdrCa
let _ = hdr_tab.(2).(32) <- hdrCa
let _ = hdr_tab.(34).(32) <- hdrCa
let hdrCo rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Content-Disposition" 2 19
then rpfn hdr hdrlen nxt rh 19 `Content_Disposition
else if hdr_scmp hdr "Content-Language" 2 16
then rpfn hdr hdrlen nxt rh 16 `Content_Language
else if hdr_scmp hdr "Content-Location" 2 16
then rpfn hdr hdrlen nxt rh 16 `Content_Location
else if hdr_scmp hdr "Content-Encoding" 2 16
then rpfn hdr hdrlen nxt rh 16 `Content_Encoding
else if hdr_scmp hdr "Content-Length" 2 14
then rpfn hdr hdrlen nxt rh 14 `Content_Length
else if hdr_scmp hdr "Content-Range" 2 13
then rpfn hdr hdrlen nxt rh 13 `Content_Range
else if hdr_scmp hdr "Content-Type" 2 12
then rpfn hdr hdrlen nxt rh 12 `Content_Type
else if hdr_scmp hdr "Content-MD5" 2 11
then rpfn hdr hdrlen nxt rh 11 `Content_MD5
else if hdr_scmp hdr "Connection" 2 10
then rpfn hdr hdrlen nxt rh 10 `Connection
else if hdr_scmp hdr "Cookie" 2 6
then rpfn hdr hdrlen nxt rh 6 `Cookie
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(2).(14) <- hdrCo
let _ = hdr_tab.(34).(14) <- hdrCo
let _ = hdr_tab.(2).(46) <- hdrCo
let _ = hdr_tab.(34).(46) <- hdrCo
let hdrDa rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Date" 2 4
then rpfn hdr hdrlen nxt rh 4 `Date
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(3).(0) <- hdrDa
let _ = hdr_tab.(35).(0) <- hdrDa
let _ = hdr_tab.(3).(32) <- hdrDa
let _ = hdr_tab.(35).(32) <- hdrDa
let hdrEx rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Expires" 2 7
then rpfn hdr hdrlen nxt rh 7 `Expires
else if hdr_scmp hdr "Expect" 2 6
then rpfn hdr hdrlen nxt rh 6 `Expect
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(4).(23) <- hdrEx
let _ = hdr_tab.(36).(23) <- hdrEx
let _ = hdr_tab.(4).(55) <- hdrEx
let _ = hdr_tab.(36).(55) <- hdrEx
let hdrFr rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "From" 2 4
then rpfn hdr hdrlen nxt rh 4 `From
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(5).(17) <- hdrFr
let _ = hdr_tab.(37).(17) <- hdrFr
let _ = hdr_tab.(5).(49) <- hdrFr
let _ = hdr_tab.(37).(49) <- hdrFr
let hdrHo rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Host" 2 4
then rpfn hdr hdrlen nxt rh 4 `Host
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(7).(14) <- hdrHo
let _ = hdr_tab.(39).(14) <- hdrHo
let _ = hdr_tab.(7).(46) <- hdrHo
let _ = hdr_tab.(39).(46) <- hdrHo
let hdrIf rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "If-Unmodified-Since" 2 19
then rpfn hdr hdrlen nxt rh 19 `If_Unmodified_Since
else if hdr_scmp hdr "If-Modified-Since" 2 17
then rpfn hdr hdrlen nxt rh 17 `If_Modified_Since
else if hdr_scmp hdr "If-None-Match" 2 13
then rpfn hdr hdrlen nxt rh 13 `If_None_Match
else if hdr_scmp hdr "If-Range" 2 8
then rpfn hdr hdrlen nxt rh 8 `If_Range
else if hdr_scmp hdr "If-Match" 2 8
then rpfn hdr hdrlen nxt rh 8 `If_Match
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(8).(5) <- hdrIf
let _ = hdr_tab.(40).(5) <- hdrIf
let _ = hdr_tab.(8).(37) <- hdrIf
let _ = hdr_tab.(40).(37) <- hdrIf
let hdrLa rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Last-Modified" 2 13
then rpfn hdr hdrlen nxt rh 13 `Last_Modified
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(11).(0) <- hdrLa
let _ = hdr_tab.(43).(0) <- hdrLa
let _ = hdr_tab.(11).(32) <- hdrLa
let _ = hdr_tab.(43).(32) <- hdrLa
let hdrMa rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Max-Forwards" 2 12
then rpfn hdr hdrlen nxt rh 12 `Max_Forwards
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(12).(0) <- hdrMa
let _ = hdr_tab.(44).(0) <- hdrMa
let _ = hdr_tab.(12).(32) <- hdrMa
let _ = hdr_tab.(44).(32) <- hdrMa
let hdrNe rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "NewCookie" 2 9
then rpfn hdr hdrlen nxt rh 9 `NewCookie
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(13).(4) <- hdrNe
let _ = hdr_tab.(45).(4) <- hdrNe
let _ = hdr_tab.(13).(36) <- hdrNe
let _ = hdr_tab.(45).(36) <- hdrNe
let hdrPr rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Proxy-Authorization" 2 19
then rpfn hdr hdrlen nxt rh 19 `Proxy_Authorization
else if hdr_scmp hdr "Pragma" 2 6
then rpfn hdr hdrlen nxt rh 6 `Pragma
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(15).(17) <- hdrPr
let _ = hdr_tab.(47).(17) <- hdrPr
let _ = hdr_tab.(15).(49) <- hdrPr
let _ = hdr_tab.(47).(49) <- hdrPr
let hdrRe rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "ReqRange" 2 8
then rpfn hdr hdrlen nxt rh 8 `ReqRange
else if hdr_scmp hdr "Referer" 2 7
then rpfn hdr hdrlen nxt rh 7 `Referer
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(17).(4) <- hdrRe
let _ = hdr_tab.(49).(4) <- hdrRe
let _ = hdr_tab.(17).(36) <- hdrRe
let _ = hdr_tab.(49).(36) <- hdrRe
let hdrTE rpfn hdr hdrlen nxt rh =
if true
then rpfn hdr hdrlen nxt rh 2 `TE
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(19).(4) <- hdrTE
let _ = hdr_tab.(51).(4) <- hdrTE
let _ = hdr_tab.(19).(36) <- hdrTE
let _ = hdr_tab.(51).(36) <- hdrTE
let hdrTr rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Transfer-Encoding" 2 17
then rpfn hdr hdrlen nxt rh 17 `Transfer_Encoding
else if hdr_scmp hdr "Trailer" 2 7
then rpfn hdr hdrlen nxt rh 7 `Trailer
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(19).(17) <- hdrTr
let _ = hdr_tab.(51).(17) <- hdrTr
let _ = hdr_tab.(19).(49) <- hdrTr
let _ = hdr_tab.(51).(49) <- hdrTr
let hdrUp rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Upgrade" 2 7
then rpfn hdr hdrlen nxt rh 7 `Upgrade
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(20).(15) <- hdrUp
let _ = hdr_tab.(52).(15) <- hdrUp
let _ = hdr_tab.(20).(47) <- hdrUp
let _ = hdr_tab.(52).(47) <- hdrUp
let hdrUs rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "User-Agent" 2 10
then rpfn hdr hdrlen nxt rh 10 `User_Agent
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(20).(18) <- hdrUs
let _ = hdr_tab.(52).(18) <- hdrUs
let _ = hdr_tab.(20).(50) <- hdrUs
let _ = hdr_tab.(52).(50) <- hdrUs
let hdrVi rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Via" 2 3
then rpfn hdr hdrlen nxt rh 3 `Via
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(21).(8) <- hdrVi
let _ = hdr_tab.(53).(8) <- hdrVi
let _ = hdr_tab.(21).(40) <- hdrVi
let _ = hdr_tab.(53).(40) <- hdrVi
let hdrWa rpfn hdr hdrlen nxt rh =
if hdr_scmp hdr "Warning" 2 7
then rpfn hdr hdrlen nxt rh 7 `Warning
else raise (ParseFail_hdr nxt)
let _ = hdr_tab.(22).(0) <- hdrWa
let _ = hdr_tab.(54).(0) <- hdrWa
let _ = hdr_tab.(22).(32) <- hdrWa
let _ = hdr_tab.(54).(32) <- hdrWa
let hdr_mms = [|('A','w');('A','x')|]
let hdr_call rpfn hdr hdrlen nxt rh =
let c0 = String.unsafe_get hdr 0 in
let c1 = String.unsafe_get hdr 1 in
if c0 < 'A' || c0 > 'w' then raise (ParseFail_hdr nxt);
if c1 < 'A' || c1 > 'x' then raise (ParseFail_hdr nxt);
hdr_tab.((Char.code c0)-65).((Char.code c1)-65) rpfn hdr hdrlen nxt rh
Jump to Line
Something went wrong with that request. Please try again.