The Trunk: Network-cmm.161.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-cmm.161.mcz

commits-2
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]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Levente Uzonyi-2
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, [hidden email] 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]!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Chris Muller-3
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 <[hidden email]> 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, [hidden email] 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]!
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Bert Freudenberg

> On 01.07.2015, at 14:55, Chris Muller <[hidden email]> wrote:
>
> Do MC overrides actually somehow "reload" the code that was overridden
> when you unload the overriding code?

Yes. It goes through the method history in the changes/sources file and loads the overridden definition.

>  If so, that is kind of amazing.

Indeed. Although scary, too. Overrides are still evil, and should not be used unless really necessary.

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

The overridden package shouldn’t actually be dirty. Did you do “changes” on it?

- Bert -

>
> 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 <[hidden email]> 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, [hidden email] 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]!
>>>
>>>
>>>
>>
>



smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Chris Muller-3
>> Do MC overrides actually somehow "reload" the code that was overridden
>> when you unload the overriding code?
>
> Yes. It goes through the method history in the changes/sources file and loads the overridden definition.
>
>>  If so, that is kind of amazing.
>
> Indeed. Although scary, too. Overrides are still evil, and should not be used unless really necessary.

I wonder if it would work even after condenseSources.  That's been
done for this release.

>> My purpose of doing this is to avoid having dirty packages in the release.
>
> The overridden package shouldn’t actually be dirty. Did you do “changes” on it?

ReleaseBuilder prepareNewRelease ends up doing that check and
complains if it finds any.  That's how I came to know about it.

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Eliot Miranda-2
Hi Chris,

On Jul 2, 2015, at 2:25 PM, Chris Muller <[hidden email]> wrote:

>>> Do MC overrides actually somehow "reload" the code that was overridden
>>> when you unload the overriding code?
>>
>> Yes. It goes through the method history in the changes/sources file and loads the overridden definition.
>>
>>> If so, that is kind of amazing.
>>
>> Indeed. Although scary, too. Overrides are still evil, and should not be used unless really necessary.
>
> I wonder if it would work even after condenseSources.  That's been
> done for this release.

Should do given that condenseSources now preserves history right?

>
>>> My purpose of doing this is to avoid having dirty packages in the release.
>>
>> The overridden package shouldn’t actually be dirty. Did you do “changes” on it?
>
> ReleaseBuilder prepareNewRelease ends up doing that check and
> complains if it finds any.  That's how I came to know about it.
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Bert Freudenberg

> On 02.07.2015, at 14:36, Eliot Miranda <[hidden email]> wrote:
>
> Hi Chris,
>
> On Jul 2, 2015, at 2:25 PM, Chris Muller <[hidden email]> wrote:
>
>>>> Do MC overrides actually somehow "reload" the code that was overridden
>>>> when you unload the overriding code?
>>>
>>> Yes. It goes through the method history in the changes/sources file and loads the overridden definition.
>>>
>>>> If so, that is kind of amazing.
>>>
>>> Indeed. Although scary, too. Overrides are still evil, and should not be used unless really necessary.
>>
>> I wonder if it would work even after condenseSources.  That's been
>> done for this release.
>
> Should do given that condenseSources now preserves history right?
Yes, condenseSources specifically keeps the history of methods in *-override protocols.

- Bert -






smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Network-cmm.161.mcz

Chris Muller-3
I believe the ReleaseBuilder process checks the "Changes" of every
package.  When we brought in WebClient, those extension methods became
no longer in the Network package (in "*WebClient-HTTP-override").  For
Changes to be smart enough it would have see if the "deleted" methods
were truly deleted, or just moved to another package as an "override"
and then..  not changed?  Hmm..

I think I'm gaining new respect for MC overrides that someone went to
such lengths for them.  Maybe there is something to them..

On Thu, Jul 2, 2015 at 4:53 PM, Bert Freudenberg <[hidden email]> wrote:

>
>> On 02.07.2015, at 14:36, Eliot Miranda <[hidden email]> wrote:
>>
>> Hi Chris,
>>
>> On Jul 2, 2015, at 2:25 PM, Chris Muller <[hidden email]> wrote:
>>
>>>>> Do MC overrides actually somehow "reload" the code that was overridden
>>>>> when you unload the overriding code?
>>>>
>>>> Yes. It goes through the method history in the changes/sources file and loads the overridden definition.
>>>>
>>>>> If so, that is kind of amazing.
>>>>
>>>> Indeed. Although scary, too. Overrides are still evil, and should not be used unless really necessary.
>>>
>>> I wonder if it would work even after condenseSources.  That's been
>>> done for this release.
>>
>> Should do given that condenseSources now preserves history right?
>
> Yes, condenseSources specifically keeps the history of methods in *-override protocols.
>
> - Bert -
>
>
>
>
>
>