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

Side by Side Diff: content/renderer/pepper/pepper_websocket_host.cc

Issue 938103002: Change pepper websocket port check to use EffectiveIntPort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_websocket_host.h" 5 #include "content/renderer/pepper/pepper_websocket_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/renderer/renderer_ppapi_host.h" 9 #include "content/public/renderer/renderer_ppapi_host.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const std::vector<std::string>& protocols) { 206 const std::vector<std::string>& protocols) {
207 // Validate url and convert it to WebURL. 207 // Validate url and convert it to WebURL.
208 GURL gurl(url); 208 GURL gurl(url);
209 url_ = gurl.spec(); 209 url_ = gurl.spec();
210 if (!gurl.is_valid()) 210 if (!gurl.is_valid())
211 return PP_ERROR_BADARGUMENT; 211 return PP_ERROR_BADARGUMENT;
212 if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss")) 212 if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss"))
213 return PP_ERROR_BADARGUMENT; 213 return PP_ERROR_BADARGUMENT;
214 if (gurl.has_ref()) 214 if (gurl.has_ref())
215 return PP_ERROR_BADARGUMENT; 215 return PP_ERROR_BADARGUMENT;
216 if (!net::IsPortAllowedByDefault(gurl.IntPort())) 216 if (!net::IsPortAllowedByDefault(gurl.EffectiveIntPort()))
217 return PP_ERROR_BADARGUMENT; 217 return PP_ERROR_BADARGUMENT;
218 WebURL web_url(gurl); 218 WebURL web_url(gurl);
219 219
220 // Validate protocols. 220 // Validate protocols.
221 std::string protocol_string; 221 std::string protocol_string;
222 for (std::vector<std::string>::const_iterator vector_it = protocols.begin(); 222 for (std::vector<std::string>::const_iterator vector_it = protocols.begin();
223 vector_it != protocols.end(); 223 vector_it != protocols.end();
224 ++vector_it) { 224 ++vector_it) {
225 225
226 // Check containing characters. 226 // Check containing characters.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 int32_t PepperWebSocketHost::OnHostMsgFail( 320 int32_t PepperWebSocketHost::OnHostMsgFail(
321 ppapi::host::HostMessageContext* context, 321 ppapi::host::HostMessageContext* context,
322 const std::string& message) { 322 const std::string& message) {
323 if (websocket_) 323 if (websocket_)
324 websocket_->fail(WebString::fromUTF8(message)); 324 websocket_->fail(WebString::fromUTF8(message));
325 return PP_OK; 325 return PP_OK;
326 } 326 }
327 327
328 } // namespace content 328 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698