| 150 | |
| 151 | |
| 152 | void cHTTPFormParser::ParseFormUrlEncoded(void) |
| 153 | { |
| 154 | // Parse m_IncomingData for all the variables; no more data is incoming, since this is called from Finish() |
| 155 | // This may not be the most performant version, but we don't care, the form data is small enough and we're not a full-fledged web server anyway |
| 156 | AStringVector Lines = StringSplit(m_IncomingData, "&"); |
| 157 | for (AStringVector::iterator itr = Lines.begin(), end = Lines.end(); itr != end; ++itr) |
| 158 | { |
| 159 | AStringVector Components = StringSplit(*itr, "="); |
| 160 | switch (Components.size()) |
| 161 | { |
| 162 | default: |
| 163 | { |
| 164 | // Neither name nor value, or too many "="s, mark this as invalid form: |
| 165 | m_IsValid = false; |
| 166 | return; |
| 167 | } |
| 168 | case 1: |
| 169 | { |
| 170 | // Only name present |
| 171 | (*this)[URLDecode(ReplaceAllCharOccurrences(Components[0], '+', ' '))] = ""; |
| 172 | break; |
| 173 | } |
| 174 | case 2: |
| 175 | { |
| 176 | // name=value format: |
| 177 | (*this)[URLDecode(ReplaceAllCharOccurrences(Components[0], '+', ' '))] = URLDecode(ReplaceAllCharOccurrences(Components[1], '+', ' ')); |
| 178 | break; |
| 179 | } |
| 180 | } |
| 181 | } // for itr - Lines[] |
| 182 | m_IncomingData.clear(); |
| 183 | } |
| 184 | |
| 185 | |
| 186 |
nothing calls this directly
no test coverage detected