'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 17 October 2002 at 11:14:39 pm'! !HttpRequest methodsFor: 'initialize-release' stamp: 'sumim 10/17/2002 23:12'! initStatusString: aString | statusLine | statusLine _ aString findTokens: ' '. (statusLine size = 3 or: [statusLine = 2]) ifTrue: [self method: statusLine first. rawUrl _ statusLine second. url _ (rawUrl copyUpTo: $?) decodeHTTP. url size + 1 < rawUrl size ifTrue: [self queryString: (rawUrl copyFrom: (url size + 2) to: rawUrl size)]. "self protocol: statusLine third"] ifFalse: [^nil]! ! !String methodsFor: 'converting' stamp: 'sumim 10/17/2002 23:09'! decodeHTTP "restore dangerous characters from %XX form, for use in HTTP transactions" | index prevIndex decodedStream code | index _ self indexOf: $%. index = 0 ifTrue: [^ self]. prevIndex _ 1. decodedStream _ WriteStream on: (String new). [index > 0] whileTrue: [ index > prevIndex ifTrue: [ decodedStream nextPutAll: (self copyFrom: prevIndex to: index - 1). prevIndex _ index]. index < (self size - 1) ifTrue: [ ((code _ self copyFrom: index + 1 to: index + 2) select: [ :ch | '0123456789ABCDEF' includes: ch]) size = 2 ifTrue: [ decodedStream nextPut: ('16r', code) asNumber asCharacter. prevIndex _ (index _ index + 2) + 1]]. index _ self indexOf: $% startingAt: index + 1]. prevIndex <= self size ifTrue: [ decodedStream nextPutAll: (self allButFirst: prevIndex - 1)]. ^ decodedStream contents! !