void UXML2Document::init() { U_TRACE_NO_PARAM(1, "UXML2Document::init()") binit = true; /* * build an XML tree from a file; we need to add default attributes * and resolve all character and entities references: required for c14n! */ xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; U_SYSCALL_VOID(xmlSubstituteEntitiesDefault, "%d", 1); /* * Do not fetch DTD over network */ // xmlExternalEntityLoader defaultEntityLoader = xmlNoNetExternalEntityLoader; U_SYSCALL_VOID(xmlSetExternalEntityLoader, "%p", xmlNoNetExternalEntityLoader); xmlLoadExtDtdDefaultValue = 0; }
void UHttpPlugIn::handlerDelete() { U_TRACE_NO_PARAM(0, "UHttpPlugIn::handlerDelete()") U_INTERNAL_DUMP("UEventFd::fd = %d", UEventFd::fd) UEventFd::fd = -1; }
void toJSON() { U_TRACE_NO_PARAM(5, "Request::toJSON()") U_JSON_TYPE_HANDLER(table, UHashMap<UString>); U_JSON_TYPE_HANDLER(radius, UString); U_JSON_TYPE_HANDLER(location, UString); U_JSON_TYPE_HANDLER(fbPermissions, UVector<UString>); }
UString Url::getService() const { U_TRACE_NO_PARAM(0, "Url::getService()") UString srv; if (service_end > 0) srv = url.substr(0U, (uint32_t)service_end); U_RETURN_STRING(srv); }
void clear() { U_TRACE_NO_PARAM(5, "Request::clear()") table.clear(); radius.clear(); location.clear(); fbPermissions.clear(); }
void UFlexer::test() { U_TRACE_NO_PARAM(0, "UFlexer::test()") YYSTYPE yyval; while (yylex(&yyval) != 0) { U_INTERNAL_DUMP("yyval = %.*S", yyval.ref.length, data.data() + yyval.ref.offset) } }
int UHttpPlugIn::handlerRead() { U_TRACE_NO_PARAM(0, "UHttpPlugIn::handlerRead()") #if defined(HAVE_SYS_INOTIFY_H) && defined(U_HTTP_INOTIFY_SUPPORT) U_INTERNAL_ASSERT_POINTER(UHTTP::cache_file) UHTTP::in_READ(); #endif U_RETURN(U_NOTIFIER_OK); }
void UHttpClient_Base::reset() { U_TRACE_NO_PARAM(0, "UHttpClient_Base::reset()") body.clear(); requestHeader->clear(); responseHeader->clear(); UClient_Base::reset(); UClient_Base::server.clear(); }
bool UProcess::fork() { U_TRACE_NO_PARAM(1, "UProcess::fork()") U_CHECK_MEMORY _pid = U_FORK(); if (child()) u_setPid(); running = (_pid != -1); U_INTERNAL_DUMP("%P running = %b", running) U_RETURN(running); }
void UDynamic::close() { U_TRACE_NO_PARAM(0, "UDynamic::close()") U_CHECK_MEMORY U_INTERNAL_ASSERT_POINTER(handle) #if defined(_MSWINDOWS_) ::FreeLibrary(handle); #else (void) U_SYSCALL(dlclose, "%p", handle); #endif err = 0; addr = 0; handle = 0; }
UShibTarget::UShibTarget() { U_TRACE_NO_PARAM(5, "UShibTarget::UShibTarget()") m_dc = create_shib_dir_config(); // Initialize the request from the parsed URL // protocol == http, https, etc // hostname == server name // port == server port // uri == resource path // method == GET, POST, etc. U_INTERNAL_DUMP("protocol = %S hostname = %S port = %d uri = %S content_type = %S remote_addr = %S method = %.*S", protocol, hostname, port, uri, content_type, remote_addr, U_HTTP_METHOD_TO_TRACE) ShibTarget::init(protocol, hostname, port, uri, content_type, remote_addr, U_http_method_list[U_http_method_num].name); }
void UThread::yield() { U_TRACE_NO_PARAM(1, "UThread::yield()") // Yields the current thread's CPU time slice to allow another thread to begin immediate execution U_INTERNAL_DUMP("cancel = %d", cancel) #ifdef HAVE_PTHREAD_CANCEL U_SYSCALL_VOID_NO_PARAM(pthread_testcancel); #elif !defined(_MSWINDOWS_) && !defined(__UNIKERNEL__) sigset_t old = 0; if (cancel != cancelInitial && cancel != cancelDisabled) { sigset_t scancel; # ifdef sigemptyset sigemptyset(&scancel); # else (void) U_SYSCALL(sigemptyset, "%p", &scancel); # endif # ifdef sigaddset sigaddset(&scancel, U_SIG_THREAD_CANCEL); # else (void) U_SYSCALL(sigaddset, "%p,%d", &scancel, U_SIG_THREAD_CANCEL); # endif (void) U_SYSCALL(pthread_sigmask, "%d,%p,%p", SIG_UNBLOCK, &scancel, &old); } #endif #ifdef HAVE_PTHREAD_YIELD (void) U_SYSCALL_NO_PARAM(pthread_yield); #endif #if !defined(HAVE_PTHREAD_CANCEL) && !defined(_MSWINDOWS_) && !defined(__UNIKERNEL__) if (old) (void) U_SYSCALL(pthread_sigmask, "%d,%p,%p", SIG_SETMASK, &old, 0); #endif }
UString USOAPParser::getFaultResponse() { U_TRACE_NO_PARAM(0, "USOAPParser::getFaultResponse()") U_INTERNAL_ASSERT_POINTER(method) URPCFault fault; UString retval(U_CAPACITY); fault.setFaultCode(); fault.getFaultReason() = (*envelope.arg)[0]; if (envelope.arg->size() > 1) fault.getDetail() = (*envelope.arg)[1]; fault.encode(retval); (void) retval.shrink(); U_RETURN_STRING(retval); }
UString URPCFault::getFaultCode() { U_TRACE_NO_PARAM(0, "URPCFault::getFaultCode()") UString retval; /* SOAP: * ---------------------------------------------------------------------------------------------------- * VersionMismatch: The faulting node found an invalid element information item instead of the expected * Envelope element information item. The namespace, local name or both did not match * the Envelope element information item required by this recommendation. * * MustUnderstand: An immediate child element information item of the SOAP Header element information * item targeted at the faulting node that was not understood by the faulting node * contained a SOAP mustUnderstand attribute information item with a value of "true". * * DataEncodingUnknown: A SOAP header block or SOAP body child element information item targeted at the * faulting SOAP node is scoped with a data encoding that the faulting node does not support. * * Sender: The message was incorrectly formed or did not contain the appropriate information in order to * succeed. For example, the message could lack the proper authentication or payment information. * It is generally an indication that the message is not to be resent without change. * * Receiver: The message could not be processed for reasons attributable to the processing of the message * rather than to the contents of the message itself. For example, processing could include * communicating with an upstream SOAP node, which did not respond. The message could succeed * if resent at a later point in time * ---------------------------------------------------------------------------------------------------- */ switch (faultCode) { case Sender: (void) retval.assign(U_CONSTANT_TO_PARAM("Client")); break; case Receiver: (void) retval.assign(U_CONSTANT_TO_PARAM("Server")); break; case MustUnderstand: (void) retval.assign(U_CONSTANT_TO_PARAM("MustUnderstand")); break; case VersionMismatch: (void) retval.assign(U_CONSTANT_TO_PARAM("VersionMismatch")); break; case DataEncodingUnknown: (void) retval.assign(U_CONSTANT_TO_PARAM("DataEncodingUnknown")); break; } U_RETURN_STRING(retval); }
UString UHttpClient_Base::getBasicAuthorizationHeader() { U_TRACE_NO_PARAM(0, "UHttpClient_Base::getBasicAuthorizationHeader()") UString headerValue(300U), tmp(100U), data(100U); // --------------------------------------------------------------------------------------------------------------------------- // According to RFC 2617 HTTP Authentication: Basic and Digest Access Authentication // --------------------------------------------------------------------------------------------------------------------------- // For "Basic" authentication, the user and password are concatentated with a colon separator before being encoded in base64. // According to RFC 2068 (HTTP/1.1) the Username and Password are defined as TEXT productions and are therefore supposed to be // encoded in ISO-8859-1 before being Base64-encoded // --------------------------------------------------------------------------------------------------------------------------- tmp.snprintf(U_CONSTANT_TO_PARAM("%v:%v"), user.rep, password.rep); UBase64::encode(tmp, data); // Authorization: Basic cy5jYXNhenphOnN0ZWZhbm8x headerValue.snprintf(U_CONSTANT_TO_PARAM("Basic %v"), data.rep); U_RETURN_STRING(headerValue); }
bool UGeoIPPlugIn::setCountryCode() { U_TRACE_NO_PARAM(1, "UGeoIPPlugIn::setCountryCode()") gir = 0; region = 0; domain_name = 0; netspeed = country_id = 0; bGEOIP_CITY_EDITION_REV1 = false; country_code = country_name = org = 0; ipnum = U_SYSCALL(_GeoIP_lookupaddress, "%s", UServer_Base::client_address); if (ipnum) { // iterate through different database types for (uint32_t i = 0; i < NUM_DB_TYPES; ++i) { if (gi[i]) { if (GEOIP_DOMAIN_EDITION == i) { domain_name = U_SYSCALL(GeoIP_name_by_ipnum, "%p,%lu", gi[i], ipnum); } else if (GEOIP_COUNTRY_EDITION == i) { country_id = U_SYSCALL(GeoIP_id_by_ipnum, "%p,%lu", gi[i], ipnum); if (country_id >= 0) { country_code = GeoIP_country_code[country_id]; country_name = GeoIP_country_name[country_id]; U_SRV_LOG_WITH_ADDR("%s: IP %.*S is from %s, %s for", GeoIPDBDescription[i], U_CLIENT_ADDRESS_TO_TRACE, country_code, country_name); } } else if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) { region = (GeoIPRegion*) U_SYSCALL(GeoIP_region_by_ipnum, "%p,%lu", gi[i], ipnum); if (region) { U_SRV_LOG_WITH_ADDR("%s: IP %.*S is from %s, %s for", GeoIPDBDescription[i], U_CLIENT_ADDRESS_TO_TRACE, region->country_code, region->region); U_SYSCALL_VOID(GeoIPRegion_delete, "%p", region); } } else if (GEOIP_CITY_EDITION_REV0 == i || GEOIP_CITY_EDITION_REV1 == i) { gir = (GeoIPRecord*) U_SYSCALL(GeoIP_record_by_ipnum, "%p,%lu", gi[i], ipnum); bGEOIP_CITY_EDITION_REV1 = (GEOIP_CITY_EDITION_REV1 == i); } else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) { org = U_SYSCALL(GeoIP_org_by_ipnum, "%p,%lu", gi[i], ipnum); } else if (GEOIP_NETSPEED_EDITION == i) { netspeed = U_SYSCALL(GeoIP_id_by_ipnum, "%p,%lu", gi[i], ipnum); /* if (netspeed == GEOIP_UNKNOWN_SPEED) {} else if (netspeed == GEOIP_DIALUP_SPEED) {} else if (netspeed == GEOIP_CABLEDSL_SPEED) {} else if (netspeed == GEOIP_CORPORATE_SPEED) {} */ } } } } if (country_code) U_RETURN(true); U_RETURN(false); }
void UThread::close() { U_TRACE_NO_PARAM(0, "UThread::close()") #ifdef _MSWINDOWS_ DWORD _tid = tid; #else pthread_t _tid = tid; #endif tid = 0; U_INTERNAL_DUMP("tid = %p first = %p next = %p", _tid, first, next) U_INTERNAL_ASSERT_POINTER(first) UThread* obj; UThread** ptr = &first; while ((obj = *ptr)) { U_INTERNAL_ASSERT_POINTER(obj) # ifdef _MSWINDOWS_ if (tid == obj->tid) # else if (pthread_equal(tid, obj->tid)) # endif { U_INTERNAL_ASSERT_EQUALS(this, obj) U_INTERNAL_ASSERT_EQUALS(next, obj->next) *ptr = next; next = 0; break; } ptr = &(*ptr)->next; } if (_tid) { # ifdef _MSWINDOWS_ // wait for real w32 thread to cleanup switch (cancel) { case cancelImmediate: TerminateThread((HANDLE)_tid, 0); break; default: SetEvent(cancellation); } (void) WaitForSingleObject((HANDLE)_tid, INFINITE); (void) U_SYSCALL(CloseHandle, "%p", cancellation); (void) U_SYSCALL(CloseHandle, "%p", (HANDLE)_tid); _endthreadex(0); # else # ifdef HAVE_PTHREAD_CANCEL (void) U_SYSCALL(pthread_cancel, "%p", _tid); # endif if (detachstate == PTHREAD_CREATE_JOINABLE) (void) U_SYSCALL(pthread_join, "%p,%p", _tid, 0); # ifdef HAVE_PTHREAD_YIELD else { (void) U_SYSCALL_NO_PARAM(pthread_yield); } # endif # endif } }