aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libxml/nanohttp.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/libxml/nanohttp.c
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libxml/nanohttp.c')
-rw-r--r--contrib/libs/libxml/nanohttp.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/libs/libxml/nanohttp.c b/contrib/libs/libxml/nanohttp.c
index 018b7e189b..24af6cb31c 100644
--- a/contrib/libs/libxml/nanohttp.c
+++ b/contrib/libs/libxml/nanohttp.c
@@ -63,8 +63,8 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#ifdef LIBXML_ZLIB_ENABLED
-#include <zlib.h>
+#ifdef LIBXML_ZLIB_ENABLED
+#include <zlib.h>
#endif
@@ -73,7 +73,7 @@
#define XML_SOCKLEN_T unsigned int
#endif
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <wsockcompat.h>
#endif
@@ -145,7 +145,7 @@ typedef struct xmlNanoHTTPCtxt {
char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */
char *encoding; /* encoding extracted from the contentType */
char *mimeType; /* Mime-Type extracted from the contentType */
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
z_stream *strm; /* Zlib stream object */
int usesGzip; /* "Content-Encoding: gzip" was detected */
#endif
@@ -175,21 +175,21 @@ xmlHTTPErrMemory(const char *extra)
*/
static int socket_errno(void) {
#ifdef _WINSOCKAPI_
- int err = WSAGetLastError();
- switch(err) {
- case WSAECONNRESET:
- return(ECONNRESET);
- case WSAEINPROGRESS:
- return(EINPROGRESS);
- case WSAEINTR:
- return(EINTR);
- case WSAESHUTDOWN:
- return(ESHUTDOWN);
- case WSAEWOULDBLOCK:
- return(EWOULDBLOCK);
- default:
- return(err);
- }
+ int err = WSAGetLastError();
+ switch(err) {
+ case WSAECONNRESET:
+ return(ECONNRESET);
+ case WSAEINPROGRESS:
+ return(EINPROGRESS);
+ case WSAEINTR:
+ return(EINTR);
+ case WSAESHUTDOWN:
+ return(ESHUTDOWN);
+ case WSAEWOULDBLOCK:
+ return(EWOULDBLOCK);
+ default:
+ return(err);
+ }
#else
return(errno);
#endif
@@ -434,7 +434,7 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
if (ctxt->mimeType != NULL) xmlFree(ctxt->mimeType);
if (ctxt->location != NULL) xmlFree(ctxt->location);
if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader);
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->strm != NULL) {
inflateEnd(ctxt->strm);
xmlFree(ctxt->strm);
@@ -636,7 +636,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt)
if ((select(ctxt->fd + 1, &rfd, NULL, NULL, &tv) < 1)
#if defined(EINTR)
- && (socket_errno() != EINTR)
+ && (socket_errno() != EINTR)
#endif
)
return (0);
@@ -817,7 +817,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
if (ctxt->authHeader != NULL)
xmlFree(ctxt->authHeader);
ctxt->authHeader = xmlMemStrdup(cur);
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
} else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Encoding:", 17) ) {
cur += 17;
while ((*cur == ' ') || (*cur == '\t')) cur++;
@@ -1088,7 +1088,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
for (res = result; res; res = res->ai_next) {
if (res->ai_family == AF_INET) {
- if ((size_t)res->ai_addrlen > sizeof(sockin)) {
+ if ((size_t)res->ai_addrlen > sizeof(sockin)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return INVALID_SOCKET;
@@ -1098,7 +1098,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
addr = (struct sockaddr *)&sockin;
#ifdef SUPPORT_IP6
} else if (have_ipv6 () && (res->ai_family == AF_INET6)) {
- if ((size_t)res->ai_addrlen > sizeof(sockin6)) {
+ if ((size_t)res->ai_addrlen > sizeof(sockin6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return INVALID_SOCKET;
@@ -1126,10 +1126,10 @@ xmlNanoHTTPConnectHost(const char *host, int port)
#endif
#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32)
{
- struct hostent *h;
- struct in_addr ia;
- int i;
-
+ struct hostent *h;
+ struct in_addr ia;
+ int i;
+
h = gethostbyname (GETHOSTBYNAME_ARG_CAST host);
if (h == NULL) {
@@ -1138,17 +1138,17 @@ xmlNanoHTTPConnectHost(const char *host, int port)
* extraction code. it work on Linux, if it work on your platform
* and one want to enable it, send me the defined(foobar) needed
*/
-#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND) && defined(__linux__)
+#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND) && defined(__linux__)
const char *h_err_txt = "";
switch (h_errno) {
case HOST_NOT_FOUND:
- h_err_txt = "Authoritative host not found";
+ h_err_txt = "Authoritative host not found";
break;
case TRY_AGAIN:
h_err_txt =
- "Non-authoritative host not found or server failure.";
+ "Non-authoritative host not found or server failure.";
break;
case NO_RECOVERY:
@@ -1273,7 +1273,7 @@ xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) {
int
xmlNanoHTTPRead(void *ctx, void *dest, int len) {
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
int bytes_read = 0;
int orig_avail_in;
int z_ret;
@@ -1283,7 +1283,7 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) {
if (dest == NULL) return(-1);
if (len <= 0) return(0);
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->usesGzip == 1) {
if (ctxt->strm == NULL) return(0);
@@ -1424,16 +1424,16 @@ retry:
/* 1 for '?' */
blen += strlen(ctxt->query) + 1;
blen += strlen(method) + strlen(ctxt->path) + 24;
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
/* reserve for possible 'Accept-Encoding: gzip' string */
blen += 23;
#endif
if (ctxt->port != 80) {
/* reserve space for ':xxxxx', incl. potential proxy */
if (proxy)
- blen += 17;
+ blen += 17;
else
- blen += 11;
+ blen += 11;
}
bp = (char*)xmlMallocAtomic(blen);
if ( bp == NULL ) {
@@ -1468,7 +1468,7 @@ retry:
ctxt->hostname, ctxt->port);
}
-#ifdef LIBXML_ZLIB_ENABLED
+#ifdef LIBXML_ZLIB_ENABLED
p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n");
#endif
@@ -1542,8 +1542,8 @@ retry:
xmlGenericError(xmlGenericErrorContext,
"\nRedirect to: %s\n", ctxt->location);
#endif
- while ( xmlNanoHTTPRecv(ctxt) > 0 )
- ;
+ while ( xmlNanoHTTPRecv(ctxt) > 0 )
+ ;
if (nbRedirects < XML_NANO_HTTP_MAX_REDIR) {
nbRedirects++;
if (redirURL != NULL)