| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 void HistoryItem::clearChildren() | 440 void HistoryItem::clearChildren() |
| 441 { | 441 { |
| 442 m_children.clear(); | 442 m_children.clear(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 String HistoryItem::formContentType() const | 445 String HistoryItem::formContentType() const |
| 446 { | 446 { |
| 447 return m_formContentType; | 447 return m_formContentType; |
| 448 } | 448 } |
| 449 | 449 |
| 450 void HistoryItem::setHTTPHeaderField(const String& name, const String& value) |
| 451 { |
| 452 m_httpHeadersMap.set(name, value); |
| 453 } |
| 454 |
| 455 const HTTPHeaderMap& HistoryItem::httpHeaderFields() const |
| 456 { |
| 457 return m_httpHeadersMap; |
| 458 } |
| 459 |
| 460 bool HistoryItem::excludeHTTPHeaderFromStorage(const String& name) const |
| 461 { |
| 462 // All header names in this list must be in lower case. |
| 463 static char* excludedList[] = { |
| 464 "accept", |
| 465 "accept-charset", |
| 466 "accept-encoding", |
| 467 "accept-language", |
| 468 "accept-ranges", |
| 469 "authorization", |
| 470 "content-encoding", |
| 471 "content-length", |
| 472 "content-location", |
| 473 "content-md5", |
| 474 "content-range", |
| 475 "content-type", |
| 476 "cookie", |
| 477 "expect", |
| 478 "host", |
| 479 "if-range", |
| 480 "origin", |
| 481 "proxy-authorization", |
| 482 "range", |
| 483 "referer", |
| 484 "te", |
| 485 "trailer", |
| 486 "transfer-encoding", |
| 487 "upgrade", |
| 488 "user-agent", |
| 489 "via", |
| 490 }; |
| 491 |
| 492 String nameLower = name.lower(); |
| 493 for (size_t i = 0; i < sizeof(excludedList) / sizeof(char*); ++i) { |
| 494 if (nameLower == excludedList[i]) |
| 495 return true; |
| 496 } |
| 497 return false; |
| 498 } |
| 499 |
| 450 void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request) | 500 void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request) |
| 451 { | 501 { |
| 452 m_referrer = request.httpReferrer(); | 502 m_referrer = request.httpReferrer(); |
| 453 | 503 |
| 504 // Store HTTP headers |
| 505 const HTTPHeaderMap& headerMap = request.httpHeaderFields(); |
| 506 HTTPHeaderMap::const_iterator it = headerMap.begin(); |
| 507 for (; it != headerMap.end(); ++it) { |
| 508 if (!excludeHTTPHeaderFromStorage(it->first)) |
| 509 m_httpHeadersMap.set(it->first, it->second); |
| 510 } |
| 511 |
| 454 if (equalIgnoringCase(request.httpMethod(), "POST")) { | 512 if (equalIgnoringCase(request.httpMethod(), "POST")) { |
| 455 // FIXME: Eventually we have to make this smart enough to handle the cas
e where | 513 // FIXME: Eventually we have to make this smart enough to handle the cas
e where |
| 456 // we have a stream for the body to handle the "data interspersed with f
iles" feature. | 514 // we have a stream for the body to handle the "data interspersed with f
iles" feature. |
| 457 m_formData = request.httpBody(); | 515 m_formData = request.httpBody(); |
| 458 m_formContentType = request.httpContentType(); | 516 m_formContentType = request.httpContentType(); |
| 459 } else { | 517 } else { |
| 460 m_formData = 0; | 518 m_formData = 0; |
| 461 m_formContentType = String(); | 519 m_formContentType = String(); |
| 462 } | 520 } |
| 463 } | 521 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } // namespace WebCore | 599 } // namespace WebCore |
| 542 | 600 |
| 543 #ifndef NDEBUG | 601 #ifndef NDEBUG |
| 544 | 602 |
| 545 int showTree(const WebCore::HistoryItem* item) | 603 int showTree(const WebCore::HistoryItem* item) |
| 546 { | 604 { |
| 547 return item->showTree(); | 605 return item->showTree(); |
| 548 } | 606 } |
| 549 | 607 |
| 550 #endif | 608 #endif |
| OLD | NEW |