Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: net/tools/flip_server/balsa_headers.cc

Issue 1566013: Fixes a problem with filename lookups when not using encoding.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/flip_server/balsa_headers.h" 5 #include "net/tools/flip_server/balsa_headers.h"
6 6
7 #include <emmintrin.h> 7 #include <emmintrin.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <ext/hash_set> 10 #include <ext/hash_set>
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } else if (transfer_encoding_is_chunked_) { 603 } else if (transfer_encoding_is_chunked_) {
604 const base::StringPiece transfer_encoding(kTransferEncoding, 604 const base::StringPiece transfer_encoding(kTransferEncoding,
605 sizeof(kTransferEncoding) - 1); 605 sizeof(kTransferEncoding) - 1);
606 RemoveAllOfHeader(transfer_encoding); 606 RemoveAllOfHeader(transfer_encoding);
607 transfer_encoding_is_chunked_ = false; 607 transfer_encoding_is_chunked_ = false;
608 } 608 }
609 content_length_status_ = BalsaHeadersEnums::VALID_CONTENT_LENGTH; 609 content_length_status_ = BalsaHeadersEnums::VALID_CONTENT_LENGTH;
610 content_length_ = length; 610 content_length_ = length;
611 // FastUInt64ToBuffer is supposed to use a maximum of kFastToBufferSize bytes. 611 // FastUInt64ToBuffer is supposed to use a maximum of kFastToBufferSize bytes.
612 char buffer[kFastToBufferSize]; 612 char buffer[kFastToBufferSize];
613 int len_converted = snprintf(buffer, sizeof(buffer), "%ld", length); 613 int len_converted = snprintf(buffer, sizeof(buffer), "%ld", (long int)length);
Mike Belshe 2010/04/02 19:41:28 nit: static_cast<long int>(length)
614 CHECK_GT(len_converted, 0); 614 CHECK_GT(len_converted, 0);
615 const base::StringPiece length_str(buffer, len_converted); 615 const base::StringPiece length_str(buffer, len_converted);
616 AppendHeader(content_length, length_str); 616 AppendHeader(content_length, length_str);
617 } 617 }
618 618
619 void BalsaHeaders::SetChunkEncoding(bool chunk_encode) { 619 void BalsaHeaders::SetChunkEncoding(bool chunk_encode) {
620 if (transfer_encoding_is_chunked_ == chunk_encode) { 620 if (transfer_encoding_is_chunked_ == chunk_encode) {
621 return; 621 return;
622 } 622 }
623 if (content_length_status_ != BalsaHeadersEnums::NO_CONTENT_LENGTH && 623 if (content_length_status_ != BalsaHeadersEnums::NO_CONTENT_LENGTH &&
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // Thus, a function to set one is equivalent to a function to set the other. 712 // Thus, a function to set one is equivalent to a function to set the other.
713 // We maintain two functions for this as it is much more descriptive, and 713 // We maintain two functions for this as it is much more descriptive, and
714 // makes code more understandable. 714 // makes code more understandable.
715 SetRequestUri(code); 715 SetRequestUri(code);
716 } 716 }
717 717
718 void BalsaHeaders::SetParsedResponseCodeAndUpdateFirstline( 718 void BalsaHeaders::SetParsedResponseCodeAndUpdateFirstline(
719 size_t parsed_response_code) { 719 size_t parsed_response_code) {
720 char buffer[kFastToBufferSize]; 720 char buffer[kFastToBufferSize];
721 int len_converted = snprintf(buffer, sizeof(buffer), 721 int len_converted = snprintf(buffer, sizeof(buffer),
722 "%ld", parsed_response_code); 722 "%ld", (long int)parsed_response_code);
Mike Belshe 2010/04/02 19:41:28 nit: static_cast.
723 CHECK_GT(len_converted, 0); 723 CHECK_GT(len_converted, 0);
724 SetResponseCode(base::StringPiece(buffer, len_converted)); 724 SetResponseCode(base::StringPiece(buffer, len_converted));
725 } 725 }
726 726
727 void BalsaHeaders::SetRequestVersion(const base::StringPiece& version) { 727 void BalsaHeaders::SetRequestVersion(const base::StringPiece& version) {
728 // This is the last of the three parts of the firstline. 728 // This is the last of the three parts of the firstline.
729 // Since whitespace_3_idx and non_whitespace_3_idx may point to the same 729 // Since whitespace_3_idx and non_whitespace_3_idx may point to the same
730 // place, we ensure below that any available space includes space for a 730 // place, we ensure below that any available space includes space for a
731 // litteral space (' ') character between the second component and the third 731 // litteral space (' ') character between the second component and the third
732 // component. If the space between whitespace_3_idx_ and 732 // component. If the space between whitespace_3_idx_ and
(...skipping 16 matching lines...) Expand all
749 749
750 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) { 750 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) {
751 // Note: There is no difference between request_version() and 751 // Note: There is no difference between request_version() and
752 // response_reason_phrase(). Thus, a function to set one is equivalent to a 752 // response_reason_phrase(). Thus, a function to set one is equivalent to a
753 // function to set the other. We maintain two functions for this as it is 753 // function to set the other. We maintain two functions for this as it is
754 // much more descriptive, and makes code more understandable. 754 // much more descriptive, and makes code more understandable.
755 SetRequestVersion(reason); 755 SetRequestVersion(reason);
756 } 756 }
757 757
758 } // namespace net 758 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/tools/flip_server/flip_in_mem_edsm_server.cc » ('j') | net/tools/flip_server/flip_in_mem_edsm_server.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698