MCPcopy Create free account
hub / github.com/acl-dev/acl / getLocalAddr

Method getLocalAddr

lib_acl_cpp/src/http/HttpServletRequest.cpp:357–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357const 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
385unsigned short HttpServletRequest::getLocalPort(void) const
386{

Callers 4

doPostMethod · 0.80
doPostMethod · 0.80
doPostMethod · 0.80
http_requestMethod · 0.80

Calls 4

safe_snprintfFunction · 0.85
dbuf_allocMethod · 0.80
get_localMethod · 0.45
get_streamMethod · 0.45

Tested by

no test coverage detected