[squeak-dev] Problems with Browse revisions in System package

Chris Muller asqueaker at gmail.com
Mon Jul 1 02:04:32 UTC 2019

Hi guys,

> url), but I'd rather change the server (squeaksource image) to accept POST
> requests as well. Then the only change needed in the image would be to
> replace httpGet: with httpPost:.

Yes, me too.

Then the only change needed in the image would be to
> replace httpGet: with httpPost:.

SqueakSource was designed since the beginning to treat every PUT request as
a file upload (.mcm or .mcz).  This is method which handles them, in

    putRequest: aProject
        | author data version response blessed |
        self expire.
        (self isAllowed: SSAccessPolicy write in: aProject)
            ifFalse: [ self authentificateProject: aProject ].
        author := self user ifNil: [ SSMember anonymousMember ].
        SSRepository current log: 'PUT ', self request url, ' (', author
initials, ')'.
        data := self request at: 'PUTData'.

        (self request url endsWith: '.mcm')
            ifTrue: [aProject addConfig: data author: author url: self
request url]
            ifFalse: [version := aProject addVersion: data author: author].

        (version notNil and: [self request accessPath second = 'blessed'])
            ifTrue: [blessed := true.
                        blessVersion: version
                        ifForbidden: [ blessed := false] ].
        "Only filesystems actually need to save here, databases already
saved, above, in addConfig:... | addVersion:"
        self saveIf: [ : repository | repository isDatabase not ].
        response := SSCreatedResponse new.
        blessed ifNotNil: [
                ifTrue: [ response nextPutAll: 'Version blessed' ]
                ifFalse: [ response nextPutAll: 'Version NOT blessed' ] ].
        self returnResponse: response

The challenge is not just reconfiguring the code, of course, but the
protocol.  The client is constrained to use of core image code only (e.g.,
not STON code) and the server needs to remain backward compatible with
older client images.  It looks like it checks its url to see if its a
'.mcm' suffix, otherwise assumes its an .mcz.  Perhaps it could do
something else if it was neither of those...?

The code running our server loads cleanly and easily into a modern image:

    Scanner allowUnderscoreAsAssignment: true.
    Installer new merge: #squeaksource.

I'd love if someone with HTTP expertise would like to take a crack at it.
While in there, don't forget Levente has another good suggestion to
increase the number of semaphores for better performance, too.

 - Chris

> Levente
> >
> > Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190630/e438cfd2/attachment.html>

More information about the Squeak-dev mailing list