public
Description: A cross-platform web server that's scripted with Nu.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nunja.git
Added option to turn off automatic tags.

I was tempted to eliminate them completely, but
then I wondered, "What would Sinatra do?"
Still looking into that...
timburks (author)
Sat Aug 23 21:46:46 -0700 2008
commit  1ed9762ad7486944a455b5b8970648da448c49fd
tree    97bc71175520996b78056270362537ea17766cf7
parent  8d485b4f198bcf89162129e8ed2a94c17da4c8e5
...
176
177
178
179
180
 
 
 
181
182
183
...
191
192
193
194
 
 
195
196
197
...
232
233
234
 
235
236
237
...
176
177
178
 
179
180
181
182
183
184
185
...
193
194
195
 
196
197
198
199
200
...
235
236
237
238
239
240
241
0
@@ -176,8 +176,10 @@
0
               ((and (set content-type (request valueForResponseHeader:"Content-Type"))
0
                     (not (text-html-pattern findInString:content-type)))
0
                (request respondWithString:BODY))
0
- ;; otherwise, return the string wrapped in html tags
0
               (else
0
+(if (Nunja autotags)
0
+ (then
0
+ ;; return the string wrapped in html tags
0
                    (set html "<html>\n<head>\n")
0
                    (if (response "HEAD")
0
                        (then (html appendString:(response "HEAD")))
0
@@ -191,7 +193,8 @@
0
                        (then (html appendString:"<body #{bodyAttributes}>\n"))
0
                        (else (html appendString:"<body>\n")))
0
                    (html appendString:BODY)
0
- (html appendString:"\n</body>\n</html>\n")
0
+ (html appendString:"\n</body>\n</html>\n"))
0
+ (else (set html BODY)))
0
                    (request respondWithString:html))))
0
      
0
      ;; Return a response redirecting the client to a new location. This method may be called from action handlers.
0
@@ -232,6 +235,7 @@
0
             (then ((matches 0) handleRequest:request))
0
             (else ;; look for a file that matches the path
0
                   (set filename (+ @root "/public" path))
0
+(NSLog filename)
0
                   (if ((NSFileManager defaultManager) fileExistsAtPath:filename)
0
                       (then
0
                            (set data (NSData dataWithContentsOfFile:filename))
...
47
48
49
 
50
51
52
...
222
223
224
 
 
 
 
 
 
 
225
226
227
...
47
48
49
50
51
52
53
...
223
224
225
226
227
228
229
230
231
232
233
234
235
0
@@ -47,6 +47,7 @@ void NunjaInit()
0
 
0
 static BOOL verbose_nunja = NO;
0
 static BOOL local_nunja = NO;
0
+static BOOL autotags = YES;
0
 
0
 @interface NunjaRequest : NSObject
0
 {
0
@@ -222,6 +223,13 @@ static void nunja_response_helper(struct evhttp_request *req, int code, NSString
0
 
0
 + (BOOL) localOnly {return local_nunja;}
0
 
0
++ (void) setAutotags:(BOOL) a
0
+{
0
+ autotags = a;
0
+}
0
+
0
++ (BOOL) autotags {return autotags;}
0
+
0
 + (void) load
0
 {
0
     NunjaInit();

Comments

    No one has commented yet.