216 |
218 |
217 "Modified: / 14-09-2010 / 19:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
219 "Modified: / 14-09-2010 / 19:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
218 ! |
220 ! |
219 |
221 |
220 writeStreamForFileNamed: aString replace: ignoreBoolean do: aBlock |
222 writeStreamForFileNamed: aString replace: ignoreBoolean do: aBlock |
221 | stream response | |
223 | stream response | |
222 stream := RWBinaryOrTextStream on: String new. |
224 stream := RWBinaryOrTextStream on: String new. |
223 aBlock value: stream. |
225 aBlock value: stream. |
224 response := HTTPSocket |
226 "/ response := HTTPSocket |
225 httpPut: stream contents |
227 "/ httpPut: stream contents |
226 to: (self urlForFileNamed: aString) |
228 "/ to: (self urlForFileNamed: aString) |
227 user: self user |
229 "/ user: self user |
228 passwd: self password. |
230 "/ passwd: self password. |
229 |
231 response := HTTPInterface |
230 (#( 'HTTP/1.1 201 ' 'HTTP/1.1 200 ' 'HTTP/1.0 201 ' 'HTTP/1.0 200 ') |
232 request:#PUT |
231 anySatisfy: [:code | response beginsWith: code ]) |
233 url:(self urlForFileNamed: aString) |
232 ifFalse: [self error: response]. |
234 fromHost:nil port:nil |
|
235 accept:#('*/*') |
|
236 fromDocument:nil |
|
237 userName:self user password: self password |
|
238 contentType:'application/octet-stream' |
|
239 contents:stream contents asString. |
|
240 |
|
241 (#( 201 200 ) includes: response responseCode) ifFalse: [self error: response]. |
|
242 |
|
243 "Modified: / 24-04-2015 / 00:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
233 ! ! |
244 ! ! |
234 |
245 |
235 !MCHttpRepository class methodsFor:'documentation'! |
246 !MCHttpRepository class methodsFor:'documentation'! |
236 |
247 |
237 version |
248 version |