- if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
- safestrncpy(cookie, &buf[15], sizeof cookie);
- cookie_to_stuff(cookie, NULL,
- c_username, sizeof c_username,
- c_password, sizeof c_password,
- c_roomname, sizeof c_roomname);
- }
- else if (!strncasecmp(buf, "Authorization: Basic ", 21)) {
- CtdlDecodeBase64(c_httpauth_string, &buf[21], strlen(&buf[21]));
- extract_token(c_httpauth_user, c_httpauth_string, 0, ':', sizeof c_httpauth_user);
- extract_token(c_httpauth_pass, c_httpauth_string, 1, ':', sizeof c_httpauth_pass);
- }
- else if (!strncasecmp(buf, "Content-length: ", 16)) {
- ContentLength = atoi(&buf[16]);
- }
- else if (!strncasecmp(buf, "Content-type: ", 14)) {
- safestrncpy(ContentType, &buf[14], sizeof ContentType);
- }
- else if (!strncasecmp(buf, "User-agent: ", 12)) {
- safestrncpy(user_agent, &buf[12], sizeof user_agent);
- #ifdef TECH_PREVIEW
- if (is_mobile_ua(&buf[12])) {
- WCC->is_mobile = 1;
- }
- #endif
- }
- else if (!strncasecmp(buf, "X-Forwarded-Host: ", 18)) {
- if (follow_xff) {
- safestrncpy(WCC->http_host, &buf[18], sizeof WCC->http_host);
- }
+ if (GetHash(HTTPHeaders, HKEY("COOKIE"), &vLine) &&
+ (vLine != NULL)){
+ cookie_to_stuff((StrBuf *)vLine, NULL,
+ c_username, sizeof c_username,
+ c_password, sizeof c_password,
+ c_roomname, sizeof c_roomname);
+ }
+ if (GetHash(HTTPHeaders, HKEY("AUTHORIZATION"), &vLine) &&
+ (vLine!=NULL)) {
+ CtdlDecodeBase64(c_httpauth_string, ChrPtr((StrBuf*)vLine), StrLength((StrBuf*)vLine));
+ extract_token(c_httpauth_user, c_httpauth_string, 0, ':', sizeof c_httpauth_user);
+ extract_token(c_httpauth_pass, c_httpauth_string, 1, ':', sizeof c_httpauth_pass);
+ }
+ if (GetHash(HTTPHeaders, HKEY("CONTENT-LENGTH"), &vLine) &&
+ (vLine!=NULL)) {
+ ContentLength = StrToi((StrBuf*)vLine);
+ }
+ if (GetHash(HTTPHeaders, HKEY("CONTENT-TYPE"), &vLine) &&
+ (vLine!=NULL)) {
+ ContentType = (StrBuf*)vLine;
+ }
+ if (GetHash(HTTPHeaders, HKEY("USER-AGENT"), &vLine) &&
+ (vLine!=NULL)) {
+ safestrncpy(user_agent, ChrPtr((StrBuf*)vLine), sizeof user_agent);
+#ifdef TECH_PREVIEW
+ if ((WCC->is_mobile < 0) && is_mobile_ua(&buf[12])) {
+ WCC->is_mobile = 1;