PWS [FIX] for Squeak 2.6

Giovanni Giorgi giovanni.giorgi at mlab.disco.unimib.it
Thu Nov 11 15:41:54 UTC 1999


--------------4BDB27AD24B2FBD361580584
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Excuse me.
    I found a small bug in PWS for Squeak 2.6, and with the  help of
Mark A. Schwenk  we fix it.
I post the change set: I do not know if this bug is even on Squeak
2.5...

The code is of  Mark A. Schwenk, I type it and test it under my platform
(WinNT 4)
resulting it works fine!
I thank again a lot Mark A. Schwenk  and Mark Guzdial for their help!



-------- Original Message --------
Subject: Re: [pws] Unable to set up AuthorizedSwiki
Date: Thu, 11 Nov 1999 04:25:42 -0500
From: "Mark A. Schwenk" <mas at wellthot.com>
Reply-To: pws at cc.gatech.edu
Organization: WellThot Inc.
To: pws at cc.gatech.edu
References: <v03102804b44f30168715@[130.207.31.66]>
<3829B2C4.545BEEE3 at wellthot.com>
<382A82E9.9C272267 at mlab.disco.unimib.it>

Giovanni Giorgi wrote:
>
> Thank you!
> How can I solve the prolem in the more clear and simple way?
> Suggestions?
>
>"Mark A. Schwenk" wrote:
>A quick hack to get you going might be to change the following method
to something like that shown:
>[...]

                         ******Diagnostic:*****

> "Mark A. Schwenk" wrote:
>
> > The problem is due to the introduction of Exceptions.
> >
> > The need for authorization gets signalled in the following method:
> >
> > Authorizer>>user: userId
> >     "Return the requesting user"
> >     ^users at: userId ifAbsent: [self error: (PWS unauthorizedFor:
realm)]
> >
> > This error gets handled in the ifError: block in the following
method.
> >
> > PWS class>>serve: aSocket
> >         "Respond to a request arriving on the given socket and
return a string to be entered in the log file."
> >
> >         | inst |
> >         inst _ self new.
> >         [inst initializeFrom: aSocket.
> >          inst getReply]
> >                 ifError: [:msg :rec | inst report: msg for: rec].
> >         aSocket closeAndDestroy: 30.
> >         ^ inst log contents
> >
> > In between the signalling and the handling, the error handling of
the new Exceptions package adds 'Error: ' to the front of the message
and so the browser sees 'Error: HTTP/1.0 ...' instead of 'HTTP/1.0 401
....'.
>
--
// Giovanni Giorgi          e-mail:
giovanni.giorgi at mlab.disco.unimib.it
// Master Thesis  at http://mars.sal.disco.unimi.it/~giorgi
// Student (& exTutor) at Depart. of Computer Science of Milan, Italy.
-------------------------------------------------------------------------

--------------4BDB27AD24B2FBD361580584
Content-Type: text/plain; charset=us-ascii;
 name="SwikiAuthorizerFix.11Nov431pm.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="SwikiAuthorizerFix.11Nov431pm.cs"


'From Squeak2.6 of 11 October 1999 [latest update: #1559] on 11 November 1999 at 4:31:18 pm'!

!PWS class methodsFor: 'ServerActions' stamp: 'GG 11/11/1999 16:23'!
serve: aSocket 
	"Respond to a request arriving on the given socket and return a string 
	to be entered in the log file."
	"FIXED by Giovanni Giorgi with help of Mark Schwenk"
	| inst reportMsg |
	inst _ self new.
	
	[inst initializeFrom: aSocket.
	inst getReply]
		ifError: 
			[:msg :rec | 
			reportMsg _ (msg size >= 8 and: [(msg copyFrom: 1 to: 7)
							= 'Error: ']) 
						ifTrue: [msg copyFrom: 8 to: msg size]
						ifFalse: [msg].
			inst report: reportMsg for: rec].
	aSocket closeAndDestroy: 30.
	^ inst log contents! !



--------------4BDB27AD24B2FBD361580584--





More information about the Squeak-dev mailing list