[squeak-dev] The Trunk: Network-cmm.161.mcz

Chris Muller asqueaker at gmail.com
Wed Jul 1 21:55:06 UTC 2015


Do MC overrides actually somehow "reload" the code that was overridden
when you unload the overriding code?  If so, that is kind of amazing.

My purpose of doing this is to avoid having dirty packages in the release.

I can no longer even use the old HTTPSocket code in my apps.  Is it
still usable?  WebClient works a lot better.  Is there a solution that
addresses all concerns?

On Wed, Jul 1, 2015 at 4:10 PM, Levente Uzonyi <leves at elte.hu> wrote:
> Hi Chris,
>
> This change is a bit against modularity, because the HTTP protocol will no
> longer work once you unload the WebClient package.
>
> Levente
>
>
> On Wed, 1 Jul 2015, commits at source.squeak.org wrote:
>
>> Chris Muller uploaded a new version of Network to project The Trunk:
>> http://source.squeak.org/trunk/Network-cmm.161.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Network-cmm.161
>> Author: cmm
>> Time: 1 July 2015, 3:26:03.655 pm
>> UUID: af917aa1-ce76-460b-ba1a-7fb49700f44a
>> Ancestors: Network-ul.160
>>
>> Remove the methods overridden by WebClient, since that has now been folded
>> into base Squeak.
>>
>> =============== Diff against Network-ul.160 ===============
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpGet:args:user:passwd: (in category
>> 'get the page') -----
>> - httpGet: url args: args user: user passwd: passwd
>> -       "Upload the contents of the stream to a file on the server.
>> -
>> -       WARNING: This method will send a basic auth header proactively.
>> -       This is necessary to avoid breaking MC and SqueakSource since SS
>> does not
>> -       return a 401 when accessing a private (global no access)
>> repository."
>> -
>> -       | authorization result |
>> -       authorization := (user , ':' , passwd) base64Encoded.
>> -       result := self
>> -               httpGet: url args: args accept: '*/*'
>> -               request: 'Authorization: Basic ' , authorization , String
>> crlf.
>> -       ^result
>> - !
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpGetDocument:args:accept:request: (in
>> category 'get the page') -----
>> - httpGetDocument: url args: args accept: mimeType request: requestString
>> -       "Return the exact contents of a web object. Asks for the given
>> MIME type. If mimeType is nil, use 'text/html'. An extra requestString may
>> be submitted and must end with crlf.  The parsed header is saved. Use a
>> proxy server if one has been registered.  tk 7/23/97 17:12"
>> -
>> -       "Note: To fetch raw data, you can use the MIME type
>> 'application/octet-stream'."
>> -
>> -       | urlString |
>> -       "Normalize the url"
>> -       urlString := (Url absoluteFromText: url) asString.
>> -
>> -       args ifNotNil: [
>> -               urlString := urlString, (self argString: args)
>> -       ].
>> -
>> -       ^(self httpRequestHandler)
>> -               httpRequest: 'GET' url: urlString headers:(
>> -                       (mimeType ifNil:[''] ifNotNil:['Accept: ',
>> mimeType, String crlf]),
>> -                       'Accept: text/html', String crlf,
>> -                       HTTPProxyCredentials,
>> -                       HTTPBlabEmail,
>> -                       requestString
>> -               ) content: nil response: nil.!
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpPost:args:user:passwd: (in category
>> 'get the page') -----
>> - httpPost: url args: args user: user passwd: passwd
>> -
>> -       "WARNING: This method will send a basic auth header proactively.
>> -       This is necessary to avoid breaking MC and SqueakSource since SS
>> does not
>> -       return a 401 when accessing a private (global no access)
>> repository."
>> -
>> -       | authorization |
>> -       authorization := (user , ':' , passwd) base64Encoded.
>> -       ^self
>> -               httpPostDocument: url args: args accept: '*/*'
>> -               request: 'Authorization: Basic ' , authorization , String
>> crlf
>> - !
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpPost:content:type:accept:request:
>> (in category 'get the page') -----
>> - httpPost: url content: postData type: contentType accept: mimeType
>> request: requestString
>> -       "like httpGET, except it does a POST instead of a GET.  POST
>> allows data to be uploaded"
>> -
>> -       | urlString |
>> -       "Normalize the url"
>> -       urlString := (Url absoluteFromText: url) asString.
>> -
>> -       ^(self httpRequestHandler)
>> -               httpRequest: 'POST' url: urlString headers:(
>> -                       'Accept: ', mimeType, String crlf,
>> -                       'Accept: text/html', String crlf,
>> -                       'Content-Type: ', contentType, String crlf,
>> -                       'Content-Length: ', (postData ifNil:['']) size,
>> String crlf,
>> -                       HTTPProxyCredentials,
>> -                       HTTPBlabEmail,
>> -                       requestString "extra user request. Authorization"
>> -               ) content: (postData ifNil:['']) response: nil!
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpPostDocument:args:accept:request:
>> (in category 'get the page') -----
>> - httpPostDocument: url  args: args accept: mimeType request:
>> requestString
>> -       "like httpGET, except it does a POST instead of a GET.  POST
>> allows data to be uploaded"
>> -
>> -       | argString  |
>> -       args ifNotNil: [
>> -               argString := self argString: args.
>> -               argString first = $? ifTrue: [argString := argString
>> allButFirst].
>> -       ].
>> -
>> -       ^self httpPost: url
>> -                       content: argString
>> -                       type: 'application/x-www-form-urlencoded'
>> -                       accept: mimeType
>> -                       request: requestString!
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpPostMultipart:args:accept:request:
>> (in category 'get the page') -----
>> - httpPostMultipart: url args: argsDict accept: mimeType request:
>> requestString
>> -       " do multipart/form-data encoding rather than x-www-urlencoded "
>> -
>> -       | mimeBorder argsStream |
>> -       mimeBorder := '----squeak-georgia-tech-', Time
>> millisecondClockValue printString, '-csl-cool-stuff-----'.
>> -       "encode the arguments dictionary"
>> -       argsStream := WriteStream on: String new.
>> -       argsDict associationsDo: [:assoc |
>> -               assoc value do: [ :value | | fieldValue |
>> -               "print the boundary"
>> -               argsStream nextPutAll: '--', mimeBorder, String crlf.
>> -               " check if it's a non-text field "
>> -               argsStream nextPutAll: 'Content-disposition:
>> multipart/form-data; name="', assoc key, '"'.
>> -               (value isKindOf: MIMEDocument)
>> -                       ifFalse: [fieldValue := value]
>> -                       ifTrue: [argsStream nextPutAll: ' filename="',
>> value url pathForFile, '"', String crlf, 'Content-Type: ', value
>> contentType.
>> -                               fieldValue := (value content
>> -                                       ifNil: [(FileStream fileNamed:
>> value url pathForFile) contentsOfEntireFile]
>> -                                       ifNotNil: [value content])
>> asString].
>> - " Transcript show: 'field=', key, '; value=', fieldValue; cr. "
>> -               argsStream nextPutAll: String crlf, String crlf,
>> fieldValue, String crlf.
>> -       ]].
>> -       argsStream nextPutAll: '--', mimeBorder, '--'.
>> -
>> -       ^self httpPost: url
>> -                       content: argsStream contents
>> -                       type:  'multipart/form-data; boundary=',
>> mimeBorder
>> -                       accept: mimeType
>> -                       request: requestString
>> - !
>>
>> Item was removed:
>> - ----- Method: HTTPSocket
>> class>>httpPostToSuperSwiki:args:accept:request: (in category 'get the
>> page') -----
>> - httpPostToSuperSwiki: url args: argsDict accept: mimeType request:
>> requestString
>> -
>> -       | mimeBorder argString |
>> -       mimeBorder := '---------SuperSwiki',Time millisecondClockValue
>> printString,'-----'.
>> -       argString := String streamContents: [ :strm |
>> -               strm nextPutAll: mimeBorder, String crlf.
>> -               argsDict associationsDo: [:assoc |
>> -                       assoc value do: [ :value |
>> -                               strm
>> -                                       nextPutAll: 'Content-disposition:
>> form-data; name="', assoc key, '"';
>> -                                       nextPutAll: String crlf;
>> -                                       nextPutAll: String crlf;
>> -                                       nextPutAll: value;
>> -                                       nextPutAll: String crlf;
>> -                                       nextPutAll: String crlf;
>> -                                       nextPutAll: mimeBorder;
>> -                                       nextPutAll: String crlf.
>> -                       ]
>> -               ].
>> -       ].
>> -
>> -       ^self httpPost: url
>> -                       content: argString
>> -                       type:  'multipart/form-data; boundary=',
>> mimeBorder
>> -                       accept: mimeType
>> -                       request: requestString
>> - !
>>
>> Item was removed:
>> - ----- Method: HTTPSocket class>>httpPut:to:user:passwd: (in category
>> 'get the page') -----
>> - httpPut: contents to: url user: user passwd: passwd
>> -       "Upload the contents of the stream to a file on the server
>> -
>> -       WARNING: This method will send a basic auth header proactively.
>> -       This is necessary to avoid breaking MC and SqueakSource since SS
>> does not
>> -       return a 401 when accessing a private (global no access)
>> repository."
>> -
>> -       | urlString resp header |
>> -
>> -       "Normalize the url"
>> -       urlString := (Url absoluteFromText: url) asString.
>> -
>> -       resp := (self httpRequestHandler)
>> -               httpRequest: 'PUT' url: urlString headers:(
>> -                       'Authorization: Basic ', (user, ':', passwd)
>> base64Encoded, String crlf,
>> -                       'Accept: */*', String crlf,
>> -                       'Content-Type: application/octet-stream', String
>> crlf,
>> -                       'Content-Length: ', (contents ifNil:['']) size,
>> String crlf,
>> -                       HTTPProxyCredentials,
>> -                       HTTPBlabEmail
>> -               ) content: contents response:[:rr| header := rr].
>> -       ^resp isString ifTrue:[header, resp] ifFalse:[header, resp
>> content]!
>>
>>
>>
>


More information about the Squeak-dev mailing list