[OGo-MacOSX] Bugs found in BasicAuthSession example

Philippe Laval macosx@opengroupware.org
Sun, 2 Apr 2006 16:53:57 +0200


--Apple-Mail-1-326196687
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

On my computer I have set the Apache server to serve BasicAuthSession  
web application at port 24000

There was two bugs :
<===== Bug : selector indexOfString is NOT defined ! (not using  
libFoundation on Mac OS X)
<===== Bug : ClickCount does NOT display itself ! (variable not  
initialized)


To who should I send the big fix ?

Philippe


====================


http://localhost/BasicAuthSession/

$ cd /Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession
$ ./build/Development/BasicAuthSession.app/Contents/MacOS/ 
BasicAuthSession -WOPort 24000
2006-04-02 15:31:16.501 BasicAuthSession[1165] Unknown class  
'MLHierarchyView' in nib file, using `NSControl' instead.
2006-04-02 15:31:16.504 BasicAuthSession[1165] Unknown class  
'MLHierarchyView' in nib file, using `NSControl' instead.
2006-04-02 15:31:16.553 BasicAuthSession[1165] Note: WOApplication  
debugging is enabled.
localhost - - [02/Apr/2006:15:31:16 GMT] "GET /BasicAuthSession HTTP/ 
1.1" 401 0 0.016 - - -
127.0.0.1 - - [02/Apr/2006:15:31:24 GMT] "GET /BasicAuthSession/ HTTP/ 
1.1" 401 0 0.006 - - -
2006-04-02 15:31:33.499 BasicAuthSession[1165] *** -[NSCFString  
indexOfString:]: selector not recognized [self = 0x5234480]

<===== Bug : selector indexOfString is NOT defined !

Modified to add the code from libFoundation.
- (unsigned int)indexOfString:(NSString *)substring
- (unsigned int)indexOfString:(NSString*)substring fromIndex: 
(unsigned)index
- (unsigned int)indexOfString:(NSString*)substring range:(NSRange)range


http://localhost/BasicAuthSession/
http://localhost/BasicAuthSession.sopex/wo/PhilippeXXXXXXXXXX/ 
00e442fd6b30285fe00.5


SessionID: PhilippeXXXXXXXXXX
ClickCount:
click


<===== Bug : ClickCount does NOT display itself !



This could have solved the problem but it does not work (I don't know  
how to set  the break points for objC methods)

$ gdb ./build/Development/BasicAuthSession.app/Contents/MacOS/ 
BasicAuthSession
(gdb) set args -WOPort 24000


- (id)initWithContext:(WOContext *)_ctx {
	if ((self = [super initWithContext:_ctx])) {
		// It could be interresting to initialize variables ;-)
		clickCount = 0;
	}
	return self;
}



$ cd /Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession
$ ./build/Development/BasicAuthSession.app/Contents/MacOS/ 
BasicAuthSession -WOPort 24000

As you will see the SOPEX application can not handle the authentication
16:11:57 |BasicAuthSession| WOHttpAdaptor listening on address *:24000
16:11:57 [ERROR] |BasicAuthSession| could not restore session for  
context <0x02864400[WOContext]: 001442fdbad02864400  
app=BasicAuthSession sn=none eid=(null) rqeid=(null)>

So I Changed to include only the session specific code when the flag  
WITHOUT_SOPEX is defined.
This will also change the application from SOPEXMain to  
WOApplicationMain (see BasicAuthSession_main.m).

Can change the Other C Flags to :
-DNeXT_RUNTIME=1 -DAPPLE_RUNTIME=1 -DNeXT_Foundation_LIBRARY=1 - 
DCOCOA_Foundation_LIBRARY=1 -DWITHOUT_SOPEX


Compile with DWITHOUT_SOPEX enabled

$ cd /Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession
$ ./build/Development_WITHOUT_SOPEX/BasicAuthSession.app/Contents/ 
MacOS/BasicAuthSession -WOPort 24000
2006-04-02 16:31:49.112 BasicAuthSession[1850] Note: WOApplication  
debugging is enabled.

If you now launch Safari at http://localhost/BasicAuthSession/

SessionID: PhilippeXXXXXXXXXX
ClickCount: 0
click

Click sometimes the "click" link, the ClickCount increments

SessionID: PhilippeXXXXXXXXXX
ClickCount: 1
click


Compile without DWITHOUT_SOPEX enabled

$ cd /Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession
$ ./build/Development/BasicAuthSession.app/Contents/MacOS/ 
BasicAuthSession -WOPort 24000
2006-04-02 16:32:58.458 BasicAuthSession[1851] Unknown class  
'MLHierarchyView' in nib file, using `NSControl' instead.
2006-04-02 16:32:58.458 BasicAuthSession[1851] Unknown class  
'MLHierarchyView' in nib file, using `NSControl' instead.
2006-04-02 16:32:58.502 BasicAuthSession[1851] Note: WOApplication  
debugging is enabled.
localhost - - [02/Apr/2006:16:32:58 GMT] "GET /BasicAuthSession HTTP/ 
1.1" 200 252 0.027 - - -
localhost - - [02/Apr/2006:16:33:03 GMT] "GET /BasicAuthSession.sopex/ 
wo/073B073B01442FE09A/001442fe09a02851400.5 HTTP/1.1" 200 206 0.004 -  
- -
localhost - - [02/Apr/2006:16:33:03 GMT] "GET /BasicAuthSession.sopex/ 
wo/073B073B01442FE09A/002442fe09f02864600.5 HTTP/1.1" 200 206 0.003 -  
- -
--Apple-Mail-1-326196687
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; "><DIV>On my computer I have set =
the Apache server to serve BasicAuthSession web application=A0at =
port=A024000</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>There was two bugs =
:</DIV><DIV>&lt;=3D=3D=3D=3D=3D Bug : selector indexOfString is NOT =
defined ! (not using=A0libFoundation on Mac OS X)</DIV><DIV>&lt;=3D=3D=3D=3D=
=3D Bug : ClickCount does NOT display itself ! (variable not =
initialized)</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>To who should I send the =
big fix ?</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Philippe</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><A =
href=3D"http://localhost/BasicAuthSession/">http://localhost/BasicAuthSess=
ion/</A></DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>$ cd =
/Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession</DIV><DIV>$ =
./build/Development/BasicAuthSession.app/Contents/MacOS/BasicAuthSession =
-WOPort 24000 </DIV><DIV>2006-04-02 15:31:16.501 BasicAuthSession[1165] =
Unknown class 'MLHierarchyView' in nib file, using `NSControl' =
instead.</DIV><DIV>2006-04-02 15:31:16.504 BasicAuthSession[1165] =
Unknown class 'MLHierarchyView' in nib file, using `NSControl' =
instead.</DIV><DIV>2006-04-02 15:31:16.553 BasicAuthSession[1165] Note: =
WOApplication debugging is enabled.</DIV><DIV>localhost - - =
[02/Apr/2006:15:31:16 GMT] "GET /BasicAuthSession HTTP/1.1" 401 0 0.016 =
- - -</DIV><DIV>127.0.0.1 - - [02/Apr/2006:15:31:24 GMT] "GET =
/BasicAuthSession/ HTTP/1.1" 401 0 0.006 - - -</DIV><DIV>2006-04-02 =
15:31:33.499 BasicAuthSession[1165] *** -[NSCFString indexOfString:]: =
selector not recognized [self =3D 0x5234480]</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>&lt;=3D=3D=3D=3D=3D Bug : =
selector indexOfString is NOT defined !</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Modified to add the code =
from libFoundation.</DIV><DIV>- (unsigned int)indexOfString:(NSString =
*)substring</DIV><DIV>- (unsigned int)indexOfString:(NSString*)substring =
fromIndex:(unsigned)index</DIV><DIV>- (unsigned =
int)indexOfString:(NSString*)substring =
range:(NSRange)range</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><A =
href=3D"http://localhost/BasicAuthSession/">http://localhost/BasicAuthSess=
ion/</A></DIV><DIV><A =
href=3D"http://localhost/BasicAuthSession.sopex/wo/PhilippeXXXXXXXXXX/00e4=
42fd6b30285fe00.5">http://localhost/BasicAuthSession.sopex/wo/PhilippeXXXX=
XXXXXX/00e442fd6b30285fe00.5</A></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>SessionID: =
PhilippeXXXXXXXXXX</DIV><DIV>ClickCount: </DIV><DIV>click</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>&lt;=3D=3D=3D=3D=3D Bug : =
ClickCount does NOT display itself !</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>This could have solved the =
problem but it does not work (I don't know how to set=A0 the break =
points for objC methods)</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>$ gdb =
./build/Development/BasicAuthSession.app/Contents/MacOS/BasicAuthSession</=
DIV><DIV>(gdb) set args -WOPort 24000</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;">- =
(</SPAN></FONT><FONT class=3D"Apple-style-span" color=3D"#760F50" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">id</SPAN></FONT><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">)initWithContext:(WOContext *)_ctx {</SPAN></FONT></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</SPAN><FONT class=3D"Apple-style-span" =
color=3D"#760F50" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">if</SPAN></FONT><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: 10px;"> =
((</SPAN></FONT><FONT class=3D"Apple-style-span" color=3D"#760F50" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">self</SPAN></FONT><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;"> =3D =
[</SPAN></FONT><FONT class=3D"Apple-style-span" color=3D"#760F50" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">super</SPAN></FONT><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 10px;"> =
initWithContext:_ctx])) {</SPAN></FONT></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</SPAN><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</SPAN><FONT =
class=3D"Apple-style-span" color=3D"#236E25" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">// It could be interresting to initialize variables =
;-)</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</SPAN><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</SPAN><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">clickCount =3D </SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#0000FF" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">0</SPAN></FONT><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">;</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</SPAN><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">}</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</SPAN><FONT =
class=3D"Apple-style-span" color=3D"#760F50" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">return</SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Monaco" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;"> </SPAN></FONT><FONT class=3D"Apple-style-span"=
 color=3D"#760F50" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">self</SPAN></FONT><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;">;</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">}</SPAN></FONT></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>$ cd =
/Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession</DIV><DIV>$ =
./build/Development/BasicAuthSession.app/Contents/MacOS/BasicAuthSession =
-WOPort 24000</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>As you will see the SOPEX =
application can not handle the authentication</DIV><DIV>16:11:57 =
|BasicAuthSession| WOHttpAdaptor listening on address =
*:24000</DIV><DIV>16:11:57 [ERROR] |BasicAuthSession| could not restore =
session for context &lt;0x02864400[WOContext]: 001442fdbad02864400 =
app=3DBasicAuthSession sn=3Dnone eid=3D(null) =
rqeid=3D(null)&gt;</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>So I Changed to include =
only the session specific code when the flag WITHOUT_SOPEX is =
defined.</DIV><DIV>This will also change the application from SOPEXMain =
to WOApplicationMain (see BasicAuthSession_main.m).</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Can change the Other C =
Flags to :</DIV><DIV>-DNeXT_RUNTIME=3D1 -DAPPLE_RUNTIME=3D1 =
-DNeXT_Foundation_LIBRARY=3D1 -DCOCOA_Foundation_LIBRARY=3D1 =
-DWITHOUT_SOPEX</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Compile with DWITHOUT_SOPEX =
enabled</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>$ cd =
/Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession</DIV><DIV>$ =
./build/Development_WITHOUT_SOPEX/BasicAuthSession.app/Contents/MacOS/Basi=
cAuthSession -WOPort 24000</DIV><DIV>2006-04-02 16:31:49.112 =
BasicAuthSession[1850] Note: WOApplication debugging is =
enabled.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>If =
you now launch Safari at <A =
href=3D"http://localhost/BasicAuthSession/">http://localhost/BasicAuthSess=
ion/</A></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>SessionID: =
PhilippeXXXXXXXXXX</DIV><DIV>ClickCount: 0</DIV><DIV>click</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Click sometimes the "click" =
link, the ClickCount increments</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>SessionID: =
PhilippeXXXXXXXXXX</DIV><DIV>ClickCount: 1</DIV><DIV>click</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Compile without =
DWITHOUT_SOPEX enabled</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>$ cd =
/Users/philippe/SOPE-4.5/sopex/Samples/BasicAuthSession</DIV><DIV>$ =
./build/Development/BasicAuthSession.app/Contents/MacOS/BasicAuthSession =
-WOPort 24000</DIV><DIV>2006-04-02 16:32:58.458 BasicAuthSession[1851] =
Unknown class 'MLHierarchyView' in nib file, using `NSControl' =
instead.</DIV><DIV>2006-04-02 16:32:58.458 BasicAuthSession[1851] =
Unknown class 'MLHierarchyView' in nib file, using `NSControl' =
instead.</DIV><DIV>2006-04-02 16:32:58.502 BasicAuthSession[1851] Note: =
WOApplication debugging is enabled.</DIV><DIV>localhost - - =
[02/Apr/2006:16:32:58 GMT] "GET /BasicAuthSession HTTP/1.1" 200 252 =
0.027 - - -</DIV><DIV>localhost - - [02/Apr/2006:16:33:03 GMT] "GET =
/BasicAuthSession.sopex/wo/073B073B01442FE09A/001442fe09a02851400.5 =
HTTP/1.1" 200 206 0.004 - - -</DIV><DIV>localhost - - =
[02/Apr/2006:16:33:03 GMT] "GET =
/BasicAuthSession.sopex/wo/073B073B01442FE09A/002442fe09f02864600.5 =
HTTP/1.1" 200 206 0.003 - - -</DIV></BODY></HTML>=

--Apple-Mail-1-326196687--