Parse immediately, only we're not going to do a full parse on this either. All we care about is the tag. Note that the tag param is outside the
| 357 | // Parse immediately, only we're not going to do a full parse on this either. All we care about is the tag. |
| 358 | // Note that the tag param is outside the <uri> |
| 359 | void SipPreposition::prepSet(const string header) |
| 360 | { |
| 361 | mFullHeader = header; |
| 362 | mDisplayName.clear(); |
| 363 | mTag.clear(); |
| 364 | mUri.clear(); |
| 365 | if (header.empty()) { return; } |
| 366 | try { |
| 367 | if (1) { |
| 368 | // We dont need the parser for this. It is trivial. |
| 369 | string uri, tail; |
| 370 | if (!crackUri(header,&mDisplayName,&uri,&tail)) { |
| 371 | LOG(ERR) << "Bad SIP Contact field:"<<header; |
| 372 | return; |
| 373 | } |
| 374 | mUri.uriSet(uri); |
| 375 | mTag = extractParam(tail.c_str(),";tag="); |
| 376 | } else { |
| 377 | // This code works fine, its just overkill. |
| 378 | SipParseLine parser(header.c_str()); |
| 379 | string thing = parser.scanNonSpace(); |
| 380 | parser.skipSpace(); |
| 381 | if (*parser.pp == '<') { |
| 382 | mDisplayName = thing; // Warning: this may or may not have quotes. |
| 383 | const char *ep = strchr(parser.pp,'>'); |
| 384 | if (!ep) { |
| 385 | LOG(ERR) << "Bad SIP Contact field:"<<header; |
| 386 | ep = parser.pp + strlen(parser.pp); // guess |
| 387 | } |
| 388 | mUri.uriSet(string(parser.pp+1,ep-parser.pp-1)); // SipUri strips the < > off the ends of the URI. |
| 389 | parser.pp = ep; |
| 390 | mTag = extractParam(parser.pp,";tag="); |
| 391 | } else { |
| 392 | mUri.uriSet(thing); |
| 393 | } |
| 394 | } |
| 395 | } catch (...) { |
| 396 | LOG(DEBUG) << "Caught SIP Parse error"; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | void parseToParams(string stuff, SipParamList ¶ms) |
| 401 | { |
no test coverage detected