mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
use safer port numbers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
86e8a7b27d
commit
6468dcfd1a
15 changed files with 141 additions and 138 deletions
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
isSecure = [[defs stringForKey: @"Secure"] boolValue];
|
isSecure = [[defs stringForKey: @"Secure"] boolValue];
|
||||||
|
|
||||||
if (port == 0) port = 54321;
|
if (port == 0) port = 1234;
|
||||||
|
|
||||||
file = [defs stringForKey: @"FileName"];
|
file = [defs stringForKey: @"FileName"];
|
||||||
RETAIN(file);
|
RETAIN(file);
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
NSString *file;
|
NSString *file;
|
||||||
int port = [[defs stringForKey: @"Port"] intValue];
|
int port = [[defs stringForKey: @"Port"] intValue];
|
||||||
|
|
||||||
if (port == 0) port = 54321;
|
if (port == 0) port = 1234;
|
||||||
|
|
||||||
count = [[defs stringForKey: @"Count"] intValue];
|
count = [[defs stringForKey: @"Count"] intValue];
|
||||||
if (count <= 0) count = 1;
|
if (count <= 0) count = 1;
|
||||||
|
|
|
@ -30,7 +30,7 @@ int main()
|
||||||
arguments: [NSArray arrayWithObjects:
|
arguments: [NSArray arrayWithObjects:
|
||||||
@"-FileName", @"Chunked.dat",
|
@"-FileName", @"Chunked.dat",
|
||||||
@"-FileHdrs", @"YES", // Headers are in file
|
@"-FileHdrs", @"YES", // Headers are in file
|
||||||
@"-Port", @"54321",
|
@"-Port", @"1234",
|
||||||
@"-Count", @"1",
|
@"-Count", @"1",
|
||||||
nil]];
|
nil]];
|
||||||
if (t != nil)
|
if (t != nil)
|
||||||
|
@ -43,7 +43,7 @@ int main()
|
||||||
|
|
||||||
// Pause to allow server subtask to set up.
|
// Pause to allow server subtask to set up.
|
||||||
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
|
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
|
||||||
u = [NSURL URLWithString: @"http://localhost:54321/chunked"];
|
u = [NSURL URLWithString: @"http://localhost:1234/chunked"];
|
||||||
// Talk to server.
|
// Talk to server.
|
||||||
data = [u resourceDataUsingCache: NO];
|
data = [u resourceDataUsingCache: NO];
|
||||||
// Get status code
|
// Get status code
|
||||||
|
@ -58,7 +58,7 @@ int main()
|
||||||
arguments: [NSArray arrayWithObjects:
|
arguments: [NSArray arrayWithObjects:
|
||||||
@"-FileName", @"Chunked.dat",
|
@"-FileName", @"Chunked.dat",
|
||||||
@"-FileHdrs", @"YES", // Headers are in file
|
@"-FileHdrs", @"YES", // Headers are in file
|
||||||
@"-Port", @"54321",
|
@"-Port", @"1234",
|
||||||
@"-Count", @"1",
|
@"-Count", @"1",
|
||||||
nil]];
|
nil]];
|
||||||
if (t != nil)
|
if (t != nil)
|
||||||
|
@ -74,7 +74,7 @@ int main()
|
||||||
|
|
||||||
// Pause to allow server subtask to set up.
|
// Pause to allow server subtask to set up.
|
||||||
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
|
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
|
||||||
u = [NSURL URLWithString: @"http://localhost:54321/chunked"];
|
u = [NSURL URLWithString: @"http://localhost:1234/chunked"];
|
||||||
|
|
||||||
request = [NSURLRequest requestWithURL: u];
|
request = [NSURLRequest requestWithURL: u];
|
||||||
response = nil;
|
response = nil;
|
||||||
|
@ -91,7 +91,7 @@ int main()
|
||||||
[t waitUntilExit];
|
[t waitUntilExit];
|
||||||
}
|
}
|
||||||
|
|
||||||
url = [NSURL URLWithString: @"http://localhost:54321/"];
|
url = [NSURL URLWithString: @"http://localhost:1234/"];
|
||||||
|
|
||||||
/* Ask the 'respond' helper to send back a response containing
|
/* Ask the 'respond' helper to send back a response containing
|
||||||
* 'hello' and to shrink the write buffer size it uses on each
|
* 'hello' and to shrink the write buffer size it uses on each
|
||||||
|
@ -134,7 +134,7 @@ int main()
|
||||||
* that loads work when handles are flushed from the cache.
|
* that loads work when handles are flushed from the cache.
|
||||||
*/
|
*/
|
||||||
u = [NSURL URLWithString: [NSString stringWithFormat:
|
u = [NSURL URLWithString: [NSString stringWithFormat:
|
||||||
@"http://localhost:54321/%d", i % 18]];
|
@"http://localhost:1234/%d", i % 18]];
|
||||||
// Talk to server.
|
// Talk to server.
|
||||||
data = [u resourceDataUsingCache: NO];
|
data = [u resourceDataUsingCache: NO];
|
||||||
// Get status code
|
// Get status code
|
||||||
|
|
|
@ -44,7 +44,7 @@ int main()
|
||||||
// remove the captured data from a possible previous run
|
// remove the captured data from a possible previous run
|
||||||
[fm removeItemAtPath: file error: NULL];
|
[fm removeItemAtPath: file error: NULL];
|
||||||
// making a POST request
|
// making a POST request
|
||||||
url = [NSURL URLWithString: @"http://localhost:54321/"];
|
url = [NSURL URLWithString: @"http://localhost:1234/"];
|
||||||
request = [NSMutableURLRequest requestWithURL: url];
|
request = [NSMutableURLRequest requestWithURL: url];
|
||||||
data = [m dataUsingEncoding: NSUTF8StringEncoding];
|
data = [m dataUsingEncoding: NSUTF8StringEncoding];
|
||||||
[request setHTTPBody: data];
|
[request setHTTPBody: data];
|
||||||
|
@ -86,7 +86,7 @@ int main()
|
||||||
// remove the captured data from a possible previous run
|
// remove the captured data from a possible previous run
|
||||||
[fm removeItemAtPath: file error: NULL];
|
[fm removeItemAtPath: file error: NULL];
|
||||||
// making a POST request
|
// making a POST request
|
||||||
url = [NSURL URLWithString: @"https://localhost:54321/"];
|
url = [NSURL URLWithString: @"https://localhost:1234/"];
|
||||||
request = [NSMutableURLRequest requestWithURL: url];
|
request = [NSMutableURLRequest requestWithURL: url];
|
||||||
data = [m dataUsingEncoding: NSUTF8StringEncoding];
|
data = [m dataUsingEncoding: NSUTF8StringEncoding];
|
||||||
[request setHTTPBody: data];
|
[request setHTTPBody: data];
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* test.
|
* test.
|
||||||
*
|
*
|
||||||
* The test case which the NSURLConnectionTest implements by default is connecting
|
* The test case which the NSURLConnectionTest implements by default is connecting
|
||||||
* to the http://localhost:54321/ whith the HTTP method 'GET'. You can change variable
|
* to the http://127.0.0.1:1234/ whith the HTTP method 'GET'. You can change variable
|
||||||
* parts of process by supplying a custom dictionary to the method -[setUpTest:]
|
* parts of process by supplying a custom dictionary to the method -[setUpTest:]
|
||||||
* before the test case is started by a call of the -[startTest:]. The use pattern:
|
* before the test case is started by a call of the -[startTest:]. The use pattern:
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
|
@ -57,12 +57,12 @@
|
||||||
* (the instance will be run within a detached thread).
|
* (the instance will be run within a detached thread).
|
||||||
* Default: NO
|
* Default: NO
|
||||||
* 'Address' - the address of the remote side.
|
* 'Address' - the address of the remote side.
|
||||||
* Default: localhost
|
* Default: 127.0.0.1
|
||||||
* 'Port' - the port of the remote side.
|
* 'Port' - the port of the remote side.
|
||||||
* Default: 54321
|
* Default: 1234
|
||||||
* 'AuxPort' - the port of the auxilliary remote side (where the connection
|
* 'AuxPort' - the port of the auxilliary remote side (where the connection
|
||||||
* to be redirected).
|
* to be redirected).
|
||||||
* Default: 54322
|
* Default: 1235
|
||||||
* 'Protocol' - the network protocol (supports currently http, https).
|
* 'Protocol' - the network protocol (supports currently http, https).
|
||||||
* Default: http
|
* Default: http
|
||||||
* 'Path' - the path of the URL.
|
* 'Path' - the path of the URL.
|
||||||
|
|
|
@ -583,15 +583,15 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
}
|
}
|
||||||
if (nil == address)
|
if (nil == address)
|
||||||
{
|
{
|
||||||
address = @"localhost";
|
address = @"127.0.0.1";
|
||||||
}
|
}
|
||||||
if (nil == port)
|
if (nil == port)
|
||||||
{
|
{
|
||||||
port = @"54321";
|
port = @"1234";
|
||||||
}
|
}
|
||||||
if (nil == auxPort)
|
if (nil == auxPort)
|
||||||
{
|
{
|
||||||
auxPort = @"54322";
|
auxPort = @"1235";
|
||||||
}
|
}
|
||||||
if (nil == path)
|
if (nil == path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* It is designed to call the delegate's callbacks (if implemented) of
|
* It is designed to call the delegate's callbacks (if implemented) of
|
||||||
* the TestWebServerDelegate protocol for every request made to
|
* the TestWebServerDelegate protocol for every request made to
|
||||||
* the SimpleWebServer's assigned address on the SimpleWebServer's assigned port
|
* the SimpleWebServer's assigned address on the SimpleWebServer's assigned port
|
||||||
* (by default 127.0.0.1 and 54321 respectively). However it currently doesn't
|
* (by default 127.0.0.1 and 1234 respectively). However it currently doesn't
|
||||||
* handle any request on it's own. Instead the class uses a collection of
|
* handle any request on it's own. Instead the class uses a collection of
|
||||||
* handlers. Every handler makes a custom response. So the TestWebServer only
|
* handlers. Every handler makes a custom response. So the TestWebServer only
|
||||||
* has to dispatch a request to a corresponding handler and then to send back
|
* has to dispatch a request to a corresponding handler and then to send back
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
* @"https", @"Protocol",
|
* @"https", @"Protocol",
|
||||||
* nil];
|
* nil];
|
||||||
* TestWebServer *server = [[TestWebServer alloc] initWithAddress: @"127.0.0.1"
|
* TestWebServer *server = [[TestWebServer alloc] initWithAddress: @"127.0.0.1"
|
||||||
* port: @"54321"
|
* port: @"1234"
|
||||||
* mode: NO
|
* mode: NO
|
||||||
* extra: extra];
|
* extra: extra];
|
||||||
* ADelegateClass *del = [ADelegateClass new];
|
* ADelegateClass *del = [ADelegateClass new];
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
* 301 "Redirect to <URL>"
|
* 301 "Redirect to <URL>"
|
||||||
* Returns in the header 'Location' a new <URL> which by default
|
* Returns in the header 'Location' a new <URL> which by default
|
||||||
* has the same protocol, address but the port is incremented by
|
* has the same protocol, address but the port is incremented by
|
||||||
* 1 (e.g. http://localhost:54322/ with other parameters set to
|
* 1 (e.g. http://127.0.0.1:1235/ with other parameters set to
|
||||||
* their default values).
|
* their default values).
|
||||||
* 400 "You have issued a request with invalid data"
|
* 400 "You have issued a request with invalid data"
|
||||||
* 401 "Invalid login or password"
|
* 401 "Invalid login or password"
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
/* default 'constants' */
|
/* default 'constants' */
|
||||||
#define DEFAULTADDRESS @"127.0.0.1"
|
#define DEFAULTADDRESS @"127.0.0.1"
|
||||||
#define DEFAULTPORT @"54321"
|
#define DEFAULTPORT @"1234"
|
||||||
#define DEFAULTMODE NO
|
#define DEFAULTMODE NO
|
||||||
#define DEFAULTLOGIN @"login"
|
#define DEFAULTLOGIN @"login"
|
||||||
#define DEFAULTPASSWORD @"password"
|
#define DEFAULTPASSWORD @"password"
|
||||||
|
@ -288,7 +288,7 @@
|
||||||
}
|
}
|
||||||
else if ([handler isKindOfClass: [Handler301 class]])
|
else if ([handler isKindOfClass: [Handler301 class]])
|
||||||
{
|
{
|
||||||
// by default http://localhost:54322/
|
// by default http://127.0.0.1:1235/
|
||||||
NSString *port = [NSString stringWithFormat: @"%u", [_port intValue] + 1]; // the TestWebServer's port + 1
|
NSString *port = [NSString stringWithFormat: @"%u", [_port intValue] + 1]; // the TestWebServer's port + 1
|
||||||
NSString *urlString = [NSString stringWithFormat: @"%@://%@:%@/",
|
NSString *urlString = [NSString stringWithFormat: @"%@://%@:%@/",
|
||||||
_isSecure ? @"https" : @"http",
|
_isSecure ? @"https" : @"http",
|
||||||
|
|
|
@ -3,25 +3,25 @@
|
||||||
* Author: Sergei Golovin <Golovin.SV@gmail.com>
|
* Author: Sergei Golovin <Golovin.SV@gmail.com>
|
||||||
*
|
*
|
||||||
* Runs two TestWebServer instances to check how the class TestWebServer
|
* Runs two TestWebServer instances to check how the class TestWebServer
|
||||||
* behaves. Visit http://localhost:54321/index to see all supported resources.
|
* behaves. Visit http://127.0.0.1:1234/index to see all supported resources.
|
||||||
*
|
*
|
||||||
* If you visit the main TestWebServer instance with the following command:
|
* If you visit the main TestWebServer instance with the following command:
|
||||||
*
|
*
|
||||||
* wget -O - --user=login --password=password http://localhost:54321/301 2>&1
|
* wget -O - --user=login --password=password http://127.0.0.1:1234/301 2>&1
|
||||||
*
|
*
|
||||||
* you should get a session log like this:
|
* you should get a session log like this:
|
||||||
*
|
*
|
||||||
* --2014-08-13 12:08:01-- http://localhost:54321/301
|
* --2014-08-13 12:08:01-- http://127.0.0.1:1234/301
|
||||||
* Resolving localhost (localhost)... 127.0.0.1
|
* Resolving 127.0.0.1 (localhost)... 127.0.0.1
|
||||||
* Connecting to localhost (localhost)|127.0.0.1|:54321... connected.
|
* Connecting to 127.0.0.1 (localhost)|127.0.0.1|:1234... connected.
|
||||||
* HTTP request sent, awaiting response... 401 Unauthorized
|
* HTTP request sent, awaiting response... 401 Unauthorized
|
||||||
* Reusing existing connection to localhost:54321.
|
* Reusing existing connection to 127.0.0.1:1234.
|
||||||
* HTTP request sent, awaiting response... 301 Moved Permanently
|
* HTTP request sent, awaiting response... 301 Moved Permanently
|
||||||
* Location: http://127.0.0.1:54322/ [following]
|
* Location: http://127.0.0.1:1235/ [following]
|
||||||
* --2014-08-13 12:08:01-- http://127.0.0.1:54322/
|
* --2014-08-13 12:08:01-- http://127.0.0.1:1235/
|
||||||
* Connecting to 127.0.0.1:54322... connected.
|
* Connecting to 127.0.0.1:1235... connected.
|
||||||
* HTTP request sent, awaiting response... 401 Unauthorized
|
* HTTP request sent, awaiting response... 401 Unauthorized
|
||||||
* Reusing existing connection to 127.0.0.1:54322.
|
* Reusing existing connection to 127.0.0.1:1235.
|
||||||
* HTTP request sent, awaiting response... 204 No Content
|
* HTTP request sent, awaiting response... 204 No Content
|
||||||
* Length: 0
|
* Length: 0
|
||||||
* Saving to: ‘STDOUT’
|
* Saving to: ‘STDOUT’
|
||||||
|
@ -63,19 +63,21 @@ int main(int argc, char **argv, char **env)
|
||||||
d = [NSDictionary dictionaryWithObjectsAndKeys:
|
d = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
// @"https", @"Protocol",
|
// @"https", @"Protocol",
|
||||||
nil];
|
nil];
|
||||||
server1 = [[[testClass testWebServerClass] alloc] initWithAddress: @"localhost"
|
server1 = [[[testClass testWebServerClass] alloc]
|
||||||
port: @"54321"
|
initWithAddress: @"127.0.0.1"
|
||||||
|
port: @"1234"
|
||||||
mode: NO
|
mode: NO
|
||||||
extra: d];
|
extra: d];
|
||||||
[server1 setDebug: debug];
|
[server1 setDebug: debug];
|
||||||
[server1 start: d]; // 127.0.0.1:54321 HTTP
|
[server1 start: d]; // 127.0.0.1:1234 HTTP
|
||||||
|
|
||||||
server2 = [[[testClass testWebServerClass] alloc] initWithAddress: @"localhost"
|
server2 = [[[testClass testWebServerClass] alloc]
|
||||||
port: @"54322"
|
initWithAddress: @"127.0.0.1"
|
||||||
|
port: @"1235"
|
||||||
mode: NO
|
mode: NO
|
||||||
extra: d];
|
extra: d];
|
||||||
[server2 setDebug: debug];
|
[server2 setDebug: debug];
|
||||||
[server2 start: d]; // 127.0.0.1:54322 HTTP
|
[server2 start: d]; // 127.0.0.1:1235 HTTP
|
||||||
|
|
||||||
while (YES)
|
while (YES)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char **argv, char **env)
|
||||||
// create a shared TestWebServer instance for performance
|
// create a shared TestWebServer instance for performance
|
||||||
server = [[testClass testWebServerClass] new];
|
server = [[testClass testWebServerClass] new];
|
||||||
[server setDebug: debug];
|
[server setDebug: debug];
|
||||||
[server start: nil]; // 127.0.0.1:54321 HTTP
|
[server start: nil]; // 127.0.0.1:1234 HTTP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple GET via HTTP with empty response's body and
|
* Simple GET via HTTP with empty response's body and
|
||||||
|
@ -49,7 +49,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "GET http://localhost:54321");
|
PASS([testCase isSuccess], "GET http://localhost:1234/");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "response 400 .... GET http://localhost:54321/400");
|
PASS([testCase isSuccess], "response 400 .... GET http://localhost:1234/400");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "payload... response 400 .... POST http://localhost:54321/400");
|
PASS([testCase isSuccess], "payload... response 400 .... POST http://localhost:1234/400");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "redirecting... GET http://localhost:54321/301");
|
PASS([testCase isSuccess], "redirecting... GET http://localhost:1234/301");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,13 @@ int main(int argc, char **argv, char **env)
|
||||||
@"HTTPS", @"Protocol",
|
@"HTTPS", @"Protocol",
|
||||||
nil];
|
nil];
|
||||||
// create a shared TestWebServer instance for performance
|
// create a shared TestWebServer instance for performance
|
||||||
server = [[[testClass testWebServerClass] alloc] initWithAddress: @"localhost"
|
server = [[[testClass testWebServerClass] alloc]
|
||||||
port: @"54321"
|
initWithAddress: @"127.0.0.1"
|
||||||
|
port: @"1234"
|
||||||
mode: NO
|
mode: NO
|
||||||
extra: d];
|
extra: d];
|
||||||
[server setDebug: debug];
|
[server setDebug: debug];
|
||||||
[server start: d]; // 127.0.0.1:54321 HTTPS
|
[server start: d]; // 127.0.0.1:1234 HTTPS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple GET via HTTPS with empty response's body and
|
* Simple GET via HTTPS with empty response's body and
|
||||||
|
@ -58,7 +59,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... GET https://localhost:54321");
|
PASS([testCase isSuccess], "HTTPS... GET https://127.0.0.1:1234/");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -73,11 +74,11 @@ int main(int argc, char **argv, char **env)
|
||||||
server, @"Instance", // we use the shared TestWebServer instance
|
server, @"Instance", // we use the shared TestWebServer instance
|
||||||
@"400", @"Path", // request the handler responding with 400
|
@"400", @"Path", // request the handler responding with 400
|
||||||
@"400", @"StatusCode", // the expected status code
|
@"400", @"StatusCode", // the expected status code
|
||||||
@"You have issued a request with invalid data", @"Content", // the expected response's body
|
@"You have issued a request with invalid data", @"Content",
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... response 400 .... GET https://localhost:54321/400");
|
PASS([testCase isSuccess], "HTTPS... response 400 .... GET https://localhost:1234/400");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -92,13 +93,13 @@ int main(int argc, char **argv, char **env)
|
||||||
server, @"Instance", // we use the shared TestWebServer instance
|
server, @"Instance", // we use the shared TestWebServer instance
|
||||||
@"400", @"Path", // request the handler responding with 400
|
@"400", @"Path", // request the handler responding with 400
|
||||||
@"400", @"StatusCode", // the expected status code
|
@"400", @"StatusCode", // the expected status code
|
||||||
@"You have issued a request with invalid data", @"Content", // the expected response's body
|
@"You have issued a request with invalid data", @"Content",
|
||||||
@"Some payload", @"Payload", // the custom payload
|
@"Some payload", @"Payload", // the custom payload
|
||||||
@"POST", @"Method", // use POST
|
@"POST", @"Method", // use POST
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... payload... response 400 .... POST https://localhost:54321/400");
|
PASS([testCase isSuccess], "HTTPS... payload... response 400 .... POST https://localhost:1234/400");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... redirecting... GET https://localhost:54321/301");
|
PASS([testCase isSuccess], "HTTPS... redirecting... GET https://localhost:1234/301");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char **argv, char **env)
|
||||||
// create a shared TestWebServer instance for performance
|
// create a shared TestWebServer instance for performance
|
||||||
server = [[testClass testWebServerClass] new];
|
server = [[testClass testWebServerClass] new];
|
||||||
[server setDebug: debug];
|
[server setDebug: debug];
|
||||||
[server start: nil]; // 127.0.0.1:54321 HTTP
|
[server start: nil]; // 127.0.0.1:1234 HTTP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple GET via HTTP without authorization with empty response's body and
|
* Simple GET via HTTP without authorization with empty response's body and
|
||||||
|
@ -59,7 +59,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "no auth... GET http://localhost:54321/withoutauth");
|
PASS([testCase isSuccess], "no auth... GET http://localhost:1234/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "no auth... response 400 .... GET http://localhost:54321/400/withoutauth");
|
PASS([testCase isSuccess], "no auth... response 400 .... GET http://localhost:1234/400/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "no auth... payload... response 400 .... POST http://localhost:54321/400/withoutauth");
|
PASS([testCase isSuccess], "no auth... payload... response 400 .... POST http://localhost:1234/400/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "no auth... redirecting... GET http://localhost:54321/301/withoutauth");
|
PASS([testCase isSuccess], "no auth... redirecting... GET http://localhost:1234/301/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,11 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
// create a shared TestWebServer instance for performance
|
// create a shared TestWebServer instance for performance
|
||||||
server = [[[testClass testWebServerClass] alloc] initWithAddress: @"localhost"
|
server = [[[testClass testWebServerClass] alloc] initWithAddress: @"localhost"
|
||||||
port: @"54321"
|
port: @"1234"
|
||||||
mode: NO
|
mode: NO
|
||||||
extra: d];
|
extra: d];
|
||||||
[server setDebug: debug];
|
[server setDebug: debug];
|
||||||
[server start: d]; // 127.0.0.1:54321 HTTPS
|
[server start: d]; // 127.0.0.1:1234 HTTPS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple GET via HTTPS without authorization with empty response's body and
|
* Simple GET via HTTPS without authorization with empty response's body and
|
||||||
|
@ -67,7 +67,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... no auth...GET https://localhost:54321/withoutauth");
|
PASS([testCase isSuccess], "HTTPS... no auth...GET https://localhost:1234/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... no auth... response 400... GET https://localhost:54321/400/withoutauth");
|
PASS([testCase isSuccess], "HTTPS... no auth... response 400... GET https://localhost:1234/400/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... no auth... payload... response 400 .... POST https://localhost:54321/400/withoutauth");
|
PASS([testCase isSuccess], "HTTPS... no auth... payload... response 400 .... POST https://localhost:1234/400/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ int main(int argc, char **argv, char **env)
|
||||||
nil];
|
nil];
|
||||||
[testCase setUpTest: d];
|
[testCase setUpTest: d];
|
||||||
[testCase startTest: d];
|
[testCase startTest: d];
|
||||||
PASS([testCase isSuccess], "HTTPS... no auth... redirecting... GET https://localhost:54321/301/withoutauth");
|
PASS([testCase isSuccess], "HTTPS... no auth... redirecting... GET https://localhost:1234/301/withoutauth");
|
||||||
[testCase tearDownTest: d];
|
[testCase tearDownTest: d];
|
||||||
DESTROY(testCase);
|
DESTROY(testCase);
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
#if GNUSTEP
|
#if GNUSTEP
|
||||||
|
|
||||||
#define PORT_LISTEN 54321
|
#define PORT_LISTEN 1234
|
||||||
#define LOCATION200 @"http://localhost:54321/200"
|
#define LOCATION200 @"http://localhost:1234/200"
|
||||||
|
|
||||||
@interface StatusServer : NSObject
|
@interface StatusServer : NSObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ int main(int argc, char **argv)
|
||||||
NSData *resp;
|
NSData *resp;
|
||||||
NSData *rxd;
|
NSData *rxd;
|
||||||
|
|
||||||
url = [NSURL URLWithString: @"http://localhost:54321/200"];
|
url = [NSURL URLWithString: @"http://localhost:1234/200"];
|
||||||
cls = [NSURLHandle URLHandleClassForURL: url];
|
cls = [NSURLHandle URLHandleClassForURL: url];
|
||||||
resp = [NSData dataWithBytes: "Hello\r\n" length: 7];
|
resp = [NSData dataWithBytes: "Hello\r\n" length: 7];
|
||||||
|
|
||||||
|
@ -45,13 +45,13 @@ int main(int argc, char **argv)
|
||||||
PASS([handle status] == NSURLHandleLoadSucceeded,
|
PASS([handle status] == NSURLHandleLoadSucceeded,
|
||||||
"200 - status: Handle load succeeded") ;
|
"200 - status: Handle load succeeded") ;
|
||||||
|
|
||||||
url = [NSURL URLWithString: @"http://localhost:54321/401"];
|
url = [NSURL URLWithString: @"http://localhost:1234/401"];
|
||||||
handle = [[[cls alloc] initWithURL: url cached: NO] autorelease];
|
handle = [[[cls alloc] initWithURL: url cached: NO] autorelease];
|
||||||
rxd = [handle loadInForeground];
|
rxd = [handle loadInForeground];
|
||||||
PASS([handle status] == NSURLHandleNotLoaded,
|
PASS([handle status] == NSURLHandleNotLoaded,
|
||||||
"401 - status: Handle load not loaded (unanswered auth challenge)");
|
"401 - status: Handle load not loaded (unanswered auth challenge)");
|
||||||
|
|
||||||
url = [NSURL URLWithString: @"http://localhost:54321/404"];
|
url = [NSURL URLWithString: @"http://localhost:1234/404"];
|
||||||
handle = [[[cls alloc] initWithURL: url cached: NO] autorelease];
|
handle = [[[cls alloc] initWithURL: url cached: NO] autorelease];
|
||||||
rxd = [handle loadInForeground];
|
rxd = [handle loadInForeground];
|
||||||
PASS([handle status] == NSURLHandleNotLoaded,
|
PASS([handle status] == NSURLHandleNotLoaded,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue