| 355 | } |
| 356 | |
| 357 | const char* HttpServletRequest::getLocalAddr(void) const |
| 358 | { |
| 359 | if (cgi_mode_) { |
| 360 | return NULL; |
| 361 | } |
| 362 | |
| 363 | if (client_ == NULL) { |
| 364 | return NULL; |
| 365 | } |
| 366 | const char* ptr = client_->get_stream().get_local(); |
| 367 | if (*ptr == 0) { |
| 368 | return NULL; |
| 369 | } |
| 370 | |
| 371 | |
| 372 | if (localAddr_ == NULL) { |
| 373 | const_cast<HttpServletRequest*>(this)->localAddr_ = (char*) |
| 374 | dbuf_->dbuf_alloc(ADDR_LEN); |
| 375 | } |
| 376 | safe_snprintf(const_cast<HttpServletRequest*>(this)->localAddr_, |
| 377 | ADDR_LEN, "%s", ptr); |
| 378 | char* p = (char*) strchr(localAddr_, ':'); |
| 379 | if (p) { |
| 380 | *p = 0; |
| 381 | } |
| 382 | return localAddr_; |
| 383 | } |
| 384 | |
| 385 | unsigned short HttpServletRequest::getLocalPort(void) const |
| 386 | { |
no test coverage detected