forked from craigmj/json4lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcgilua_patch.html
executable file
·187 lines (159 loc) · 5.48 KB
/
cgilua_patch.html
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<html>
<head>
<title>JSON4Lua and JSONRPC4Lua</title>
<style type="text/css">
body {
font-family: Arial, Helvetica, Geneva;
font-size: 10pt;
}
.copyright {
color: #999999;
font-size: 8pt;
text-align:center;
}
.navBar {
border-left: 1px solid lightgray;
border-right: 1px solid lightgray;
border-bottom: 1px solid lightgray;
margin-top:5px;
margin-bottom: 5px;
}
.navBar h1 {
background-image: url('pics/lunartone.gif');
background-color: #e0c088;
color: white;
font-size: 9pt;
margin: 0px;
padding: 4px;
}
.navBar .navItem a {
color: #999999;
font-size: 8pt;
padding: 2px 2px 2px 10px;
text-decoration:none;
}
.navBar .navItem a:hover {
color: #ff9900;
text-decoration: underline;
}
.titleBar {
border-bottom: 2px dotted gray;
font-size: 20pt;
font-weight: bold;
margin-bottom: 15px;
width: 100%;
}
.workArea {
border: 1px none lightgray;
font-family: Times New Roman;
padding: 8px;
padding-left: 15px;
}
.workArea a {
font-weight: bold;
text-decoration: none;
}
.workArea a:hover {
color: #ff9900;
text-decoration: underline;
}
.workArea .downloadTable {
border: 1px solid lightgray;
padding: 0px;
margin: 0px;
}
.workArea .downloadTable * th {
background-color: #e0c088;
background-image: url('pics/lunartone.gif');
color: white;
}
.workArea .downloadTable * tr {
border: 1px solid lightgray;
}
.workArea .downloadTable * td {
vertical-align: top;
}
.workArea * dt {
font-size: 12pt;
margin-top: 10px;
}
.workArea * .example {
background-color: #ffffcc;
border: 1px dashed lightgray;
padding: 10px;
}
.workArea h1 {
font-size: 16pt;
font-weight: bold;
}
.workArea h2 {
font-size: 14pt;
font-weight: normal;
color: gray;
}
</style>
<body>
<table border="0">
<tr>
<td valign="top">
<img src="pics/json4lua.gif"><p/>
<!-- NAVIGATION BARS -->
<div class="navBar">
<h1>Home Page</h1>
<div class="navItem"><a href="index.html#news">Latest News</a></div>
<div class="navItem"><a href="index.html#introduction">Introduction</a></div>
<div class="navItem"><a href="index.html#licence">Licence</a></div>
<div class="navItem"><a href="index.html#requirements">Requirements</a></div>
<div class="navItem"><a href="index.html#download">Download</a></div>
<div class="navItem"><a href="index.html#installation">Installation</a></div>
<div class="navItem"><a href="index.html#usage">Usage & Reference</a></div>
<div class="navItem"><a href="index.html#roadmap">History & Roadmap</a></div>
</div> <!-- end of navigation bar: This Site -->
<div class="navBar">
<h1>json.luaforge</h1>
<div class="navItem"><a href="http://luaforge.net/projects/json/">Summary</a></div>
<div class="navItem"><a href="http://luaforge.net/forum/?group_id=143">Forums</a></div>
<div class="navItem"><a href="http://luaforge.net/tracker/?group_id=143">Tracker</a></div>
<div class="navItem"><a href="http://luaforge.net/news/?group_id=143">News</a></div>
<!--<div class="navItem"><a href="http://luaforge.net/scm/?group_id=143">CVS</a></div>-->
<div class="navItem"><a href="http://luaforge.net/frs/?group_id=143">Files</a></div>
</div> <!-- end of navigation bar: json.luaforge -->
<div class="navBar">
<h1>Lua</h1>
<div class="navItem"><a href="http://www.lua.org/">Lua</a></div>
<div class="navItem"><a href="http://www.luaforge.net/">Lua Forge</a></div>
<div class="navItem"><a href="http://www.keplerproject.org/cgilua/">CGI Lua</a></div>
<div class="navItem"><a href="http://www.keplerproject.org/compat/">Lua compat-5.1</a></div>
<div class="navItem"><a href="http://www.cs.princeton.edu/~diego/professional/luasocket/">Lua Socket 2.0</a></div>
<div class="navItem"><a href="http://www.keplerproject.org/xavante/">Xavante</a></div>
</div> <!-- end of navigation bar: Lua Resources -->
<div class="navBar">
<h1>JSON</h1>
<div class="navItem"><a href="http://www.json.org/">json.org</a></div>
<div class="navItem"><a href="http://www.json-rpc.org/">json-rpc.org</a></div>
</div> <!-- end of navigation bar: Lua Resources -->
</td>
<!-- MAIN WORK AREA -->
<td valign="top" class="workArea">
<div class="titleBar">Patching CGILua to handle <code>text/plain</code></div>
<!-- cgilua_patch.html -->
JSON RPC (both the JSONRPC4Lua implementation and the <a href="http://www.jsolait.net/">jsolait Javascript</a> implementation) send the http request with a Content-Type of <code>text/plain</code>.<p/>
CGILua 5.0 does not accept <code>text/plain</code> content, and will generate an error of 'Unsupported Media Type: text/plain'.<p/>
This is easily patched in CGILua 5.0 by making the following change to <code>cgilua/post.lua</code>, line 286:<p/>
Change:<pre>
elseif strfind (contenttype, "text/xml") then
</pre>
to
<pre>
elseif strfind (contenttype, "text/xml") or strfind (contenttype, "text/plain") then
</pre>
This makes CGILua handle <code>text/plain</code> as it does <code>text/xml</code>, without parsing the incoming POST data.<p/>
<b>Please note:</b> I have requested the maintainers of CGILua to make this change to CGILua, whereafter this patch will no longer be required.
</td>
</tr>
<tr>
<td colspan="2" class="copyright">© 2005 Craig Mason-Jones</td>
</tr>
</table>
</body>
</html>