| 425 | ***********************************************************************/ |
| 426 | |
| 427 | const char * |
| 428 | URLImpl::set_scheme(HdrHeap *heap, const char *scheme_str, int scheme_wks_idx, int length, bool copy_string) |
| 429 | { |
| 430 | const char *scheme_wks; |
| 431 | url_called_set(this); |
| 432 | if (length == 0) { |
| 433 | scheme_str = nullptr; |
| 434 | } |
| 435 | |
| 436 | mime_str_u16_set(heap, scheme_str, length, &(this->m_ptr_scheme), &(this->m_len_scheme), copy_string); |
| 437 | |
| 438 | this->m_scheme_wks_idx = scheme_wks_idx; |
| 439 | if (scheme_wks_idx >= 0) { |
| 440 | scheme_wks = hdrtoken_index_to_wks(scheme_wks_idx); |
| 441 | } else { |
| 442 | scheme_wks = nullptr; |
| 443 | } |
| 444 | |
| 445 | if (scheme_wks == URL_SCHEME_HTTP || scheme_wks == URL_SCHEME_WS) { |
| 446 | this->m_url_type = URL_TYPE_HTTP; |
| 447 | } else if (scheme_wks == URL_SCHEME_HTTPS || scheme_wks == URL_SCHEME_WSS) { |
| 448 | this->m_url_type = URL_TYPE_HTTPS; |
| 449 | } else { |
| 450 | this->m_url_type = URL_TYPE_HTTP; |
| 451 | } |
| 452 | |
| 453 | return scheme_wks; // tokenized string or NULL if not well known |
| 454 | } |
| 455 | |
| 456 | /*------------------------------------------------------------------------- |
| 457 | -------------------------------------------------------------------------*/ |
no test coverage detected