-const char parsers_rcs[] = "$Id: parsers.c,v 1.41 2001/11/05 23:43:05 steudten Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.44 2001/12/14 01:22:54 steudten Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
*
* Revisions :
* $Log: parsers.c,v $
+ * Revision 1.44 2001/12/14 01:22:54 steudten
+ * Remove 'user:pass@' from 'proto://user:pass@host' for the
+ * new added header 'Host: ..'. (See Req ID 491818)
+ *
+ * Revision 1.43 2001/11/23 00:26:38 jongfoster
+ * Fixing two really stupid errors in my previous commit
+ *
+ * Revision 1.42 2001/11/22 21:59:30 jongfoster
+ * Adding code to handle +no-cookies-keep
+ *
* Revision 1.41 2001/11/05 23:43:05 steudten
* Add time+date to log files.
*
*********************************************************************/
void client_host_adder(struct client_state *csp)
{
- char *p = NULL;
+ char *p = NULL,
+ *pos = NULL;
+ if ( !csp->http->hostport || !*(csp->http->hostport)) return;
p = strsav(p, "Host: ");
- p = strsav(p, csp->http->hostport);
-
+ /*
+ ** remove 'user:pass@' from 'proto://user:pass@host'
+ */
+ if ( (pos = strchr( csp->http->hostport, '@')) != NULL )
+ {
+ p = strsav(p, pos+1);
+ }
+ else
+ {
+ p = strsav(p, csp->http->hostport);
+ }
log_error(LOG_LEVEL_HEADER, "addh: %s", p);
enlist(csp->headers, p);
*/
char tempbuf[ BUFFER_SIZE ];
time_t now;
- struct tm *tm_now;
+ struct tm tm_now;
time (&now);
- tm_now = localtime (&now);
- strftime (tempbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", tm_now);
+#ifdef HAVE_LOCALTIME_R
+ tm_now = *localtime_r(&now, &tm_now);
+#else
+ tm_now = *localtime (&now);
+#endif
+ strftime(tempbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", &tm_now);
fprintf(csp->config->jar, "%s %s\t%s\n", tempbuf, csp->http->host, (s + v->len + 1));
}
* since the behaviour of strcpy is undefined for overlapping
* strings.)
*/
- memmove(cur_tag, next_tag, strlen(next_tag));
+ memmove(cur_tag, next_tag, strlen(next_tag) + 1);
/* That changed the header, need to issue a log message */
changed = 1;
}
}
- log_error(LOG_LEVEL_HEADER, "Changed cookie to a temporary one.");
+ if (changed)
+ {
+ log_error(LOG_LEVEL_HEADER, "Changed cookie to a temporary one.");
+ }
return result;
}