Skip to content
This repository
tag: v1200
Fetching contributors…

Cannot retrieve contributors at this time

file 99 lines (92 sloc) 4.443 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
%%%%%%%%%%%%%%%%%%%%%%% -*-erlang-*-

%
% 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/>.
%
%%% General headers %%%
%%%%%%%%%%%%%%%%%%%%%%%
-define Cache_Control str = "Cache-Control: " str "\r\n"
-define Connection str = "Connection: " str "\r\n"
-define Date str = "Date: " str "\r\n"
-define Pragma str = "Pragma: " str "\r\n"
-define Trailer str = "Trailer: " str "\r\n"
-define Transfer_Encoding str = "Transfer-Encoding: " str "\r\n"
-define Upgrade str = "Upgrade: " str "\r\n"
-define Via str = "Via: " str "\r\n"
-define Warning str = "Warning: " str "\r\n"
-define Allow str = "Allow: " str "\r\n"

%%%%%%%%%%%%%%%%%%%%%%
%%% Entity headers %%%
%%%%%%%%%%%%%%%%%%%%%%
-define Content_Encoding str = "Content-Encoding: " str "\r\n"
-define Content_Language str = "Content-Language: " str "\r\n"
-define Content_Length (nb:int64) = "Content-Length: " nb "\r\n"
-define Content_Location str = "Content-Location: " str "\r\n"
-define Content_MD5 str = "Content-MD5: " str "\r\n"
-define Content_Range str = "Content-Range: " str "\r\n"
-define Content_Type (str,lst : string list) = "Content-Type: " !"\r\n" !";" str (";" !";" !"\r\n" string)* as lst "\r\n"
-define Content_Disposition (str,lst : string list) = "Content-Disposition: " !"\r\n" !";" str (";" !";" !"\r\n" string)* as lst "\r\n"
%-define Content_Disposition str = "Content-Disposition: " str "\r\n"
-define Expires str = "Expires: " str "\r\n"
-define Last_Modified str = "Last-Modified: " str "\r\n"

%%%%%%%%%%%%%%%%%%%%%%%%
%%% Requests headers %%%
%%%%%%%%%%%%%%%%%%%%%%%%
-define Accept str = "Accept: " str "\r\n"
-define Accept_Charset str = "Accept-Charset: " str "\r\n"
-define Accept_Encoding str = "Accept-Encoding: " str "\r\n"
-define Accept_Language str = "Accept-Language: " str "\r\n"
-define Authorization str = "Authorization: " str "\r\n"
-define Expect str = "Expect: " str "\r\n"
-define From str = "From: " str "\r\n"
-define Host str = "Host: " str "\r\n"
-define If_Match str = "If-Match: " str "\r\n"
-define If_Modified_Since str = "If-Modified-Since: " str "\r\n"
-define If_None_Match str = "If-None-Match: " str "\r\n"
-define If_Range str = "If-Range: " str "\r\n"
-define If_Unmodified_Since str = "If-Unmodified-Since: " str "\r\n"
-define Keep_Alive (nb:int) = "Keep-Alive: " nb "\r\n"
-define Max_Forwards str = "Max-Forwards: " str "\r\n"
-define Proxy_Authorization str = "Proxy-Authorization: " str "\r\n"
-define ReqRange str = "ReqRange: " str "\r\n"
-define Referer str = "Referer: " str "\r\n"
-define TE str = "TE: " str "\r\n"
-define User_Agent str = "User-Agent: " str "\r\n"
-define X_Forwarded_For str = "X-Forwarded-For: " str "\r\n"

%%%%%%%%%%%%%%%%%%%%%%%%
%%% Response headers %%%
%%%%%%%%%%%%%%%%%%%%%%%%
-define Accept_Ranges str = "Accept-Ranges: " str "\r\n"
-define Age str = "Age: " str "\r\n"
-define ETag str = "ETag: " str "\r\n"
-define Location str = "Location: " str "\r\n"
-define Proxy_Authenticate str = "Proxy-Authenticate: " str "\r\n"
-define Retry_After str = "Retry-After: " str "\r\n"
-define Server str = "Server: " str "\r\n"
-define Vary str = "Vary: " str "\r\n"
-define WWW_Authenticate str = "WWW-Authenticate: " str "\r\n"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Uncategorised headers %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-define Set_Cookie str = "Set-Cookie: " str "\r\n" % (coded) server updates UA
-define Cookie str = "Cookie: " str "\r\n" % (coded) UA returns to server
% (uncoded) server keeps internal id
-define MyCookie ((found:bool),ecid,ecstr,icid,icstr) =
                 "MyCookie: found=" found " " ecid "=" ecstr "; " icid "=" icstr "\r\n"

-define Set_Cookie2 str = "Set-Cookie2: " str "\r\n"
%-define Cookie2 ver = "Cookie2: $Version=" "\""? ver "\""? "\r\n" % ho hum.
-define Cookie2 str = "Cookie2: " str "\r\n"

-define Origin str = "Origin: " str "\r\n"
Something went wrong with that request. Please try again.