Method: Mechanize::HTTP::WWWAuthenticateParser#quoted_string

Defined in:
lib/mechanize/http/www_authenticate_parser.rb

#quoted_stringObject

quoted-string = ( <“> *(qdtext | quoted-pair ) <”> )

qdtext        = <any TEXT except <">>
quoted-pair   = "\" CHAR

For TEXT, the rules of RFC 2047 are ignored.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/mechanize/http/www_authenticate_parser.rb', line 151

def quoted_string
  return nil unless @scanner.scan(/"/)

  text = String.new

  while true do
    chunk = @scanner.scan(/[\r\n \t\x21\x23-\x7e\u0080-\u00ff]+/) # not " which is \x22

    if chunk then
      text << chunk

      text << @scanner.get_byte if
        chunk.end_with? '\\' and '"' == @scanner.peek(1)
    else
      if '"' == @scanner.peek(1) then
        @scanner.get_byte
        break
      else
        return nil
      end
    end
  end

  text
end