hank
2017-03-03 71172661cf242ba67cf68c387ce24079ead55930
commit | author | age
6e1425 1 //
H 2 //    wax_http_connection.h
3 //    RentList
4 //
5 //    Created by Corey Johnson on 8/9/09.
6 //    Copyright 2009 ProbablyInteractive. All rights reserved.
7 //
8
9 #import <UIKit/UIKit.h>
10 //#import "lua.h"
11 #import <lua/lua.h>
12
13 enum {
14     WAX_HTTP_UNKNOWN,
15     WAX_HTTP_TEXT,
16     WAX_HTTP_BINARY, // Like an image or something
17     WAX_HTTP_JSON,
18     WAX_HTTP_XML
19 };
20
21 #define WAX_HTTP_CALLBACK_FUNCTION_NAME "callback"
22 #define WAX_HTTP_PROGRESS_CALLBACK_FUNCTION_NAME "progressCallback"
23 #define WAX_HTTP_AUTH_CALLBACK_FUNCTION_NAME "authCallback"
24 #define WAX_HTTP_REDIRECT_CALLBACK_FUNCTION_NAME "redirectCallback"
25
26 @interface wax_http_connection : NSURLConnection {
27     lua_State *L;
28     NSMutableData *_data;
29     NSHTTPURLResponse *_response;
30     NSURLRequest *_request;
31     NSTimer *_timeoutTimer;
32     NSError *_error;
33     
34     NSTimeInterval _timeout;
35     int _format;
36     bool _finished;
37     bool _canceled;
38 }
39
40 @property (nonatomic, assign) NSHTTPURLResponse *response;
41
42 @property (nonatomic, assign) int format;
43 @property (nonatomic, readonly, getter=isFinished) bool finished;
44
45 - (id)initWithRequest:(NSURLRequest *)urlRequest timeout:(NSTimeInterval)timeout luaState:(lua_State *)luaState;
46 - (void)callRedirectCallback:(NSURLResponse *)redirectResponse;
47 - (BOOL)callLuaAuthCallback:(NSURLAuthenticationChallenge *)challenge;
48 - (void)callLuaProgressCallback;
49 - (void)callLuaCallback;
50
51 // HSHTTPURLResponse Delegate Methods
52 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
53
54 @end
55