OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 const char* ToString(HttpHeader header) { | 144 const char* ToString(HttpHeader header) { |
145 return Enum<HttpHeader>::Name(header); | 145 return Enum<HttpHeader>::Name(header); |
146 } | 146 } |
147 | 147 |
148 bool FromString(HttpHeader& header, const std::string& str) { | 148 bool FromString(HttpHeader& header, const std::string& str) { |
149 return Enum<HttpHeader>::Parse(header, str); | 149 return Enum<HttpHeader>::Parse(header, str); |
150 } | 150 } |
151 | 151 |
152 bool HttpCodeHasBody(uint32 code) { | 152 bool HttpCodeHasBody(uint32_t code) { |
153 return !HttpCodeIsInformational(code) | 153 return !HttpCodeIsInformational(code) |
154 && (code != HC_NO_CONTENT) && (code != HC_NOT_MODIFIED); | 154 && (code != HC_NO_CONTENT) && (code != HC_NOT_MODIFIED); |
155 } | 155 } |
156 | 156 |
157 bool HttpCodeIsCacheable(uint32 code) { | 157 bool HttpCodeIsCacheable(uint32_t code) { |
158 switch (code) { | 158 switch (code) { |
159 case HC_OK: | 159 case HC_OK: |
160 case HC_NON_AUTHORITATIVE: | 160 case HC_NON_AUTHORITATIVE: |
161 case HC_PARTIAL_CONTENT: | 161 case HC_PARTIAL_CONTENT: |
162 case HC_MULTIPLE_CHOICES: | 162 case HC_MULTIPLE_CHOICES: |
163 case HC_MOVED_PERMANENTLY: | 163 case HC_MOVED_PERMANENTLY: |
164 case HC_GONE: | 164 case HC_GONE: |
165 return true; | 165 return true; |
166 default: | 166 default: |
167 return false; | 167 return false; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 HttpData::clear(release_document); | 592 HttpData::clear(release_document); |
593 } | 593 } |
594 | 594 |
595 void | 595 void |
596 HttpResponseData::copy(const HttpResponseData& src) { | 596 HttpResponseData::copy(const HttpResponseData& src) { |
597 scode = src.scode; | 597 scode = src.scode; |
598 message = src.message; | 598 message = src.message; |
599 HttpData::copy(src); | 599 HttpData::copy(src); |
600 } | 600 } |
601 | 601 |
602 void | 602 void HttpResponseData::set_success(uint32_t scode) { |
603 HttpResponseData::set_success(uint32 scode) { | |
604 this->scode = scode; | 603 this->scode = scode; |
605 message.clear(); | 604 message.clear(); |
606 setHeader(HH_CONTENT_LENGTH, "0", false); | 605 setHeader(HH_CONTENT_LENGTH, "0", false); |
607 } | 606 } |
608 | 607 |
609 void | 608 void HttpResponseData::set_success(const std::string& content_type, |
610 HttpResponseData::set_success(const std::string& content_type, | 609 StreamInterface* document, |
611 StreamInterface* document, | 610 uint32_t scode) { |
612 uint32 scode) { | |
613 this->scode = scode; | 611 this->scode = scode; |
614 message.erase(message.begin(), message.end()); | 612 message.erase(message.begin(), message.end()); |
615 setContent(content_type, document); | 613 setContent(content_type, document); |
616 } | 614 } |
617 | 615 |
618 void | 616 void HttpResponseData::set_redirect(const std::string& location, |
619 HttpResponseData::set_redirect(const std::string& location, uint32 scode) { | 617 uint32_t scode) { |
620 this->scode = scode; | 618 this->scode = scode; |
621 message.clear(); | 619 message.clear(); |
622 setHeader(HH_LOCATION, location); | 620 setHeader(HH_LOCATION, location); |
623 setHeader(HH_CONTENT_LENGTH, "0", false); | 621 setHeader(HH_CONTENT_LENGTH, "0", false); |
624 } | 622 } |
625 | 623 |
626 void | 624 void HttpResponseData::set_error(uint32_t scode) { |
627 HttpResponseData::set_error(uint32 scode) { | |
628 this->scode = scode; | 625 this->scode = scode; |
629 message.clear(); | 626 message.clear(); |
630 setHeader(HH_CONTENT_LENGTH, "0", false); | 627 setHeader(HH_CONTENT_LENGTH, "0", false); |
631 } | 628 } |
632 | 629 |
633 size_t | 630 size_t |
634 HttpResponseData::formatLeader(char* buffer, size_t size) const { | 631 HttpResponseData::formatLeader(char* buffer, size_t size) const { |
635 size_t len = sprintfn(buffer, size, "HTTP/%s %lu", ToString(version), scode); | 632 size_t len = sprintfn(buffer, size, "HTTP/%s %lu", ToString(version), scode); |
636 if (!message.empty()) { | 633 if (!message.empty()) { |
637 len += sprintfn(buffer + len, size - len, " %.*s", | 634 len += sprintfn(buffer + len, size - len, " %.*s", |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 //| ISC_REQ_USE_SUPPLIED_CREDS | 901 //| ISC_REQ_USE_SUPPLIED_CREDS |
905 ; | 902 ; |
906 | 903 |
907 ::TimeStamp lifetime; | 904 ::TimeStamp lifetime; |
908 SECURITY_STATUS ret = S_OK; | 905 SECURITY_STATUS ret = S_OK; |
909 ULONG ret_flags = 0, flags = NEG_FLAGS_DEFAULT; | 906 ULONG ret_flags = 0, flags = NEG_FLAGS_DEFAULT; |
910 | 907 |
911 bool specify_credentials = !username.empty(); | 908 bool specify_credentials = !username.empty(); |
912 size_t steps = 0; | 909 size_t steps = 0; |
913 | 910 |
914 //uint32 now = Time(); | 911 // uint32_t now = Time(); |
915 | 912 |
916 NegotiateAuthContext * neg = static_cast<NegotiateAuthContext *>(context); | 913 NegotiateAuthContext * neg = static_cast<NegotiateAuthContext *>(context); |
917 if (neg) { | 914 if (neg) { |
918 const size_t max_steps = 10; | 915 const size_t max_steps = 10; |
919 if (++neg->steps >= max_steps) { | 916 if (++neg->steps >= max_steps) { |
920 LOG(WARNING) << "AsyncHttpsProxySocket::Authenticate(Negotiate) too many
retries"; | 917 LOG(WARNING) << "AsyncHttpsProxySocket::Authenticate(Negotiate) too many
retries"; |
921 return HAR_ERROR; | 918 return HAR_ERROR; |
922 } | 919 } |
923 steps = neg->steps; | 920 steps = neg->steps; |
924 | 921 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 } | 1045 } |
1049 #endif | 1046 #endif |
1050 #endif // WEBRTC_WIN | 1047 #endif // WEBRTC_WIN |
1051 | 1048 |
1052 return HAR_IGNORE; | 1049 return HAR_IGNORE; |
1053 } | 1050 } |
1054 | 1051 |
1055 ////////////////////////////////////////////////////////////////////// | 1052 ////////////////////////////////////////////////////////////////////// |
1056 | 1053 |
1057 } // namespace rtc | 1054 } // namespace rtc |
OLD | NEW |