| Index: net/spdy/spdy_alt_svc_wire_format.cc
|
| diff --git a/net/spdy/spdy_alt_svc_wire_format.cc b/net/spdy/spdy_alt_svc_wire_format.cc
|
| index 38c8fdde36b044c3b1f37f95d05172a9e0d6a034..e94b4fa719569e1bebd5d8a29fe21a2b2849fbd6 100644
|
| --- a/net/spdy/spdy_alt_svc_wire_format.cc
|
| +++ b/net/spdy/spdy_alt_svc_wire_format.cc
|
| @@ -303,20 +303,39 @@ bool SpdyAltSvcWireFormat::ParseAltAuthority(StringPiece::const_iterator c,
|
| std::string* host,
|
| uint16_t* port) {
|
| host->clear();
|
| - for (; c != end && *c != ':'; ++c) {
|
| - if (*c == '"') {
|
| - // Port is mandatory.
|
| + if (c == end) {
|
| + return false;
|
| + }
|
| + if (*c == '[') {
|
| + for (; c != end && *c != ']'; ++c) {
|
| + if (*c == '"') {
|
| + // Port is mandatory.
|
| + return false;
|
| + }
|
| + host->push_back(*c);
|
| + }
|
| + if (c == end) {
|
| return false;
|
| }
|
| - if (*c == '\\') {
|
| - ++c;
|
| - if (c == end) {
|
| + DCHECK_EQ(']', *c);
|
| + host->push_back(*c);
|
| + ++c;
|
| + } else {
|
| + for (; c != end && *c != ':'; ++c) {
|
| + if (*c == '"') {
|
| + // Port is mandatory.
|
| return false;
|
| }
|
| + if (*c == '\\') {
|
| + ++c;
|
| + if (c == end) {
|
| + return false;
|
| + }
|
| + }
|
| + host->push_back(*c);
|
| }
|
| - host->push_back(*c);
|
| }
|
| - if (c == end) {
|
| + if (c == end || *c != ':') {
|
| return false;
|
| }
|
| DCHECK_EQ(':', *c);
|
|
|