void Get_feed_list::process_current_state(void) { MLIB_D("Getting Google Reader's %1 list...", this->state_list_name()); #if GROV_OFFLINE_DEVELOPMENT QFile list(this->state_list_name() + ".list"); if(list.open(QIODevice::ReadOnly)) this->request_finished(NULL, "", list.readAll()); else this->request_finished(NULL, _F("Error while reading '%1'.", list.fileName()), ""); #else QString url; switch(this->state) { case STATE_GETTING_TAG_LIST: case STATE_GETTING_STREAM_PREFERENCE_LIST: case STATE_GETTING_SUBSCRIPTION_LIST: url = "https://www.google.com/reader/api/0/" + this->state_list_name() + "/list"; break; default: this->failed(tr("Logical error.")); return; break; } this->get( url + "?output=xml&client=" + QUrl::toPercentEncoding(get_user_agent()) ); #endif }
int read_record(FILE *fp, struct log_entry *entry) { char buffer[REFERER_MAXLEN]; int ret; int seconds; ret = fscanf(fp, "%d.%d | %d | " "%" TO_STR(IP_MAXLEN) "s | " "%" TO_STR(HEAD_ST_MAXLEN) "s | " "%d | " "%" TO_STR(METHOD_MAXLEN) "s | " "%" TO_STR(URI_MAXLEN) "s | " "%" TO_STR(USERNAME_MAXLEN) "s | " "%" TO_STR(HSTATUS_MAXLEN) "s | " "%" TO_STR(MIMETYPE_MAXLEN) "s | " "%d | ", &entry->time, &seconds, &entry->elaps, entry->ipaddr, entry->head_st, &entry->len, entry->method, entry->uri, entry->username, entry->h_status, entry->mime_type, &entry->port); if (get_user_agent(fp, buffer, USERAGENT_MAXLEN, entry->user_agent) == -1 || get_referer(fp, buffer, REFERER_MAXLEN, entry->referer) == -1) return -1; if (ret < 2) return 1; return 0; }
static void iterate_xml(apr_pool_t *p, apr_xml_elem *e, apr_hash_t *device_hash) { apr_xml_elem *child_element, *device; apr_xml_attr *attr, *attr2; DeviceInfo *device_info; int tablet; char *mobile_browser; char *user_agent = NULL; if ( e->first_child ) { child_element = e->first_child; while (child_element) { if ( strcmp(child_element->name, "capability") == 0 ) { if (child_element->attr) { attr = child_element->attr; device_info = apr_palloc(p, sizeof(device_info)); device_info->is_mobile = FALSE; device_info->is_tablet = FALSE; while (attr) { if ( strcmp(attr->value, "mobile_browser") == 0 ) { mobile_browser = get_mobile_browser_value(child_element); user_agent = get_user_agent(child_element); device_info->is_mobile=TRUE; } if ( strcmp(attr->value, "is_tablet") == 0 ) { tablet = is_tablet(child_element); user_agent = get_user_agent(child_element); device_info->is_tablet=tablet; device_info->is_mobile=TRUE; // all tablets are also mobile } attr = attr->next; } if ( user_agent != NULL && ( strcmp(user_agent,"") != 0 )) { if ( device_info->is_mobile ) { apr_hash_set(device_hash, user_agent, APR_HASH_KEY_STRING, device_info); // ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL , "UA: %s, mobile_browser: %s, is_mobile: %d, is_tablet: %d", user_agent, mobile_browser, device_info->is_mobile, device_info->is_tablet ); } } } } iterate_xml(p, child_element, device_hash); child_element = child_element->next; } } }
static int print_it(const char const *formatwithtid, const char const *msg, int log_level) { int ret; // fusedav-valhalla standardizing on names BINDING, SITE, and ENVIRONMENT ret = sd_journal_send("MESSAGE=%s%s", formatwithtid, msg, "PRIORITY=%d", log_level, "USER_AGENT=%s", get_user_agent(), "SITE=%s", log_key_value[SITE], "ENVIRONMENT=%s", log_key_value[ENVIRONMENT], "HOST_ADDRESS=%s", log_key_value[HOST_ADDRESS], "TID=%lu", syscall(SYS_gettid), "PACKAGE_VERSION=%s", PACKAGE_VERSION, NULL); return ret; }
void HTTPS_Proxy::connect_ready() { if (m_state != Connect){ log(L_WARN, "Proxy::connect_ready in bad state"); error_state(CONNECT_ERROR, 0); return; } bIn.packetStart(); bOut << "CONNECT " << m_host.c_str() << ":" << number(m_port).c_str() << " HTTP/1.0\r\n" << "User-Agent: " << get_user_agent().c_str() << "\r\n"; send_auth(); bOut << "\r\n"; m_state = WaitConnect; write(); }
utility_retcode_t init_rtsp_client(struct rtsp_client *client) { utility_retcode_t ret; FUNC_ENTER; syscalls_memset(client, 0, sizeof(*client)); get_client_name(client->name, sizeof(client->name)); get_client_host(client->host, sizeof(client->host)); get_client_version(client->version, sizeof(client->version)); get_user_agent(client->user_agent, sizeof(client->user_agent)); ret = get_random_bytes(client->challenge, sizeof(client->challenge)); if (UTILITY_SUCCESS != ret) { goto out; } ret = get_client_instance(client->instance, sizeof(client->instance)); out: FUNC_RETURN; return ret; }