Commit faf702b1003788941d91219a8f79bf494bcef9d4

Authored by Matti Virkkunen
1 parent 3fa44424

Don't try to parse headers twice in HTTP client.

libpurple/linehttptransport.cpp
... ... @@ -278,7 +278,8 @@ void LineHttpTransport::ssl_read(gint, PurpleInputCondition) {
278 278  
279 279 response_str.append((const char *)buf, count);
280 280  
281   - try_parse_response_header();
  281 + if (content_length_ < 0)
  282 + try_parse_response_header();
282 283  
283 284 if (content_length_ >= 0 && response_str.size() >= (size_t)content_length_) {
284 285 purple_input_remove(input_handle);
... ... @@ -360,6 +361,9 @@ void LineHttpTransport::try_parse_response_header() {
360 361 if (header_end == std::string::npos)
361 362 return;
362 363  
  364 + if (content_length_ == -1)
  365 + content_length_ = 0;
  366 +
363 367 std::istringstream stream(response_str.substr(0, header_end));
364 368  
365 369 stream.ignore(256, ' ');
... ...