| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 m_mode = Incomplete; | 289 m_mode = Incomplete; |
| 290 int statusCode; | 290 int statusCode; |
| 291 String statusText; | 291 String statusText; |
| 292 int lineLength = readStatusLine(header, len, statusCode, statusText); | 292 int lineLength = readStatusLine(header, len, statusCode, statusText); |
| 293 if (lineLength == -1) | 293 if (lineLength == -1) |
| 294 return -1; | 294 return -1; |
| 295 if (statusCode == -1) { | 295 if (statusCode == -1) { |
| 296 m_mode = Failed; // m_failureReason is set inside readStatusLine(). | 296 m_mode = Failed; // m_failureReason is set inside readStatusLine(). |
| 297 return len; | 297 return len; |
| 298 } | 298 } |
| 299 LOG(Network, "response code: %d", statusCode); | 299 LOG_INFO(Network, "response code: %d", statusCode); |
| 300 m_response.setStatusCode(statusCode); | 300 m_response.setStatusCode(statusCode); |
| 301 m_response.setStatusText(statusText); | 301 m_response.setStatusText(statusText); |
| 302 if (statusCode != 101) { | 302 if (statusCode != 101) { |
| 303 m_mode = Failed; | 303 m_mode = Failed; |
| 304 m_failureReason = "Unexpected response code: " + String::number(statusCo
de); | 304 m_failureReason = "Unexpected response code: " + String::number(statusCo
de); |
| 305 return len; | 305 return len; |
| 306 } | 306 } |
| 307 m_mode = Normal; | 307 m_mode = Normal; |
| 308 if (!strnstr(header, "\r\n\r\n", len)) { | 308 if (!strnstr(header, "\r\n\r\n", len)) { |
| 309 // Just hasn't been received fully yet. | 309 // Just hasn't been received fully yet. |
| 310 m_mode = Incomplete; | 310 m_mode = Incomplete; |
| 311 return -1; | 311 return -1; |
| 312 } | 312 } |
| 313 const char* p = readHTTPHeaders(header + lineLength, header + len); | 313 const char* p = readHTTPHeaders(header + lineLength, header + len); |
| 314 if (!p) { | 314 if (!p) { |
| 315 LOG(Network, "readHTTPHeaders failed"); | 315 LOG_INFO(Network, "readHTTPHeaders failed"); |
| 316 m_mode = Failed; // m_failureReason is set inside readHTTPHeaders(). | 316 m_mode = Failed; // m_failureReason is set inside readHTTPHeaders(). |
| 317 return len; | 317 return len; |
| 318 } | 318 } |
| 319 if (!checkResponseHeaders()) { | 319 if (!checkResponseHeaders()) { |
| 320 LOG(Network, "header process failed"); | 320 LOG_INFO(Network, "header process failed"); |
| 321 m_mode = Failed; | 321 m_mode = Failed; |
| 322 return p - header; | 322 return p - header; |
| 323 } | 323 } |
| 324 | 324 |
| 325 m_mode = Connected; | 325 m_mode = Connected; |
| 326 return p - header; | 326 return p - header; |
| 327 } | 327 } |
| 328 | 328 |
| 329 WebSocketHandshake::Mode WebSocketHandshake::mode() const | 329 WebSocketHandshake::Mode WebSocketHandshake::mode() const |
| 330 { | 330 { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 m_failureReason = "Error during WebSocket handshake: Sec-WebSocket-P
rotocol mismatch"; | 549 m_failureReason = "Error during WebSocket handshake: Sec-WebSocket-P
rotocol mismatch"; |
| 550 return false; | 550 return false; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 return true; | 553 return true; |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace WebCore | 556 } // namespace WebCore |
| 557 | 557 |
| 558 #endif // ENABLE(WEB_SOCKETS) | 558 #endif // ENABLE(WEB_SOCKETS) |
| OLD | NEW |