1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-01 10:06:59 +03:00

Removed unconditionnal references to snprintf, Daniel.

This commit is contained in:
Daniel Veillard
1999-09-23 23:08:42 +00:00
parent dd6b36766f
commit 335849b934
2 changed files with 61 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Fri Sep 24 01:06:36 CEST 1999
* nanohttp.c: conditionned references to snprintf with HAVE_SNPRINTF
Fri Sep 24 00:15:58 CEST 1999 Fri Sep 24 00:15:58 CEST 1999
* libxml.spec.in: fixed the alpha compile problem * libxml.spec.in: fixed the alpha compile problem

View File

@ -619,8 +619,13 @@ retry:
return(NULL); return(NULL);
} }
ctxt->fd = ret; ctxt->fd = ret;
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf),"GET %s HTTP/1.0\r\nHost: %s\r\n\r\n", snprintf(buf, sizeof(buf),"GET %s HTTP/1.0\r\nHost: %s\r\n\r\n",
ctxt->path, ctxt->hostname); ctxt->path, ctxt->hostname);
#else
sprintf(buf, "GET %s HTTP/1.0\r\nHost: %s\r\n\r\n",
ctxt->path, ctxt->hostname);
#endif
#ifdef DEBUG_HTTP #ifdef DEBUG_HTTP
printf("-> GET %s HTTP/1.0\n-> Host: %s\n\n", printf("-> GET %s HTTP/1.0\n-> Host: %s\n\n",
ctxt->path, ctxt->hostname); ctxt->path, ctxt->hostname);
@ -788,50 +793,102 @@ retry:
if (input == NULL) { if (input == NULL) {
if (headers == NULL) { if (headers == NULL) {
if ((contentType == NULL) || (*contentType == NULL)) { if ((contentType == NULL) || (*contentType == NULL)) {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\n\r\n", "%s %s HTTP/1.0\r\nHost: %s\r\n\r\n",
method, ctxt->path, ctxt->hostname); method, ctxt->path, ctxt->hostname);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\n\r\n",
method, ctxt->path, ctxt->hostname);
#endif
} else { } else {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n\r\n", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n\r\n",
method, ctxt->path, ctxt->hostname, *contentType); method, ctxt->path, ctxt->hostname, *contentType);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n\r\n",
method, ctxt->path, ctxt->hostname, *contentType);
#endif
} }
} else { } else {
if ((contentType == NULL) || (*contentType == NULL)) { if ((contentType == NULL) || (*contentType == NULL)) {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\n%s\r\n", "%s %s HTTP/1.0\r\nHost: %s\r\n%s\r\n",
method, ctxt->path, ctxt->hostname, headers); method, ctxt->path, ctxt->hostname, headers);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\n%s\r\n",
method, ctxt->path, ctxt->hostname, headers);
#endif
} else { } else {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n%s\r\n", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n%s\r\n",
method, ctxt->path, ctxt->hostname, *contentType, method, ctxt->path, ctxt->hostname, *contentType,
headers); headers);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\n%s\r\n",
method, ctxt->path, ctxt->hostname, *contentType,
headers);
#endif
} }
} }
} else { } else {
int len = strlen(input); int len = strlen(input);
if (headers == NULL) { if (headers == NULL) {
if ((contentType == NULL) || (*contentType == NULL)) { if ((contentType == NULL) || (*contentType == NULL)) {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s",
method, ctxt->path, ctxt->hostname, len, input); method, ctxt->path, ctxt->hostname, len, input);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s",
method, ctxt->path, ctxt->hostname, len, input);
#endif
} else { } else {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s",
method, ctxt->path, ctxt->hostname, *contentType, len, method, ctxt->path, ctxt->hostname, *contentType, len,
input); input);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s",
method, ctxt->path, ctxt->hostname, *contentType, len,
input);
#endif
} }
} else { } else {
if ((contentType == NULL) || (*contentType == NULL)) { if ((contentType == NULL) || (*contentType == NULL)) {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n%s\r\n%s", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n%s\r\n%s",
method, ctxt->path, ctxt->hostname, len, method, ctxt->path, ctxt->hostname, len,
headers, input); headers, input);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Length: %d\r\n%s\r\n%s",
method, ctxt->path, ctxt->hostname, len,
headers, input);
#endif
} else { } else {
#ifdef HAVE_SNPRINTF
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n%s", "%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n%s",
method, ctxt->path, ctxt->hostname, *contentType, method, ctxt->path, ctxt->hostname, *contentType,
len, headers, input); len, headers, input);
#else
sprintf(buf,
"%s %s HTTP/1.0\r\nHost: %s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n%s",
method, ctxt->path, ctxt->hostname, *contentType,
len, headers, input);
#endif
} }
} }
} }