diff options
author | Tatsuya Kinoshita <tats@vega.ocn.ne.jp> | 2011-05-04 07:23:02 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@vega.ocn.ne.jp> | 2011-05-04 07:23:02 +0000 |
commit | 6db339b3d7a391f196e7c4b725a4ed0bd00f31cf (patch) | |
tree | 7d6fed976b72694d61fc595a745d394e1cd6e1a5 /url.c | |
parent | Adding upstream version 0.5.1 (diff) | |
download | w3m-upstream/0.5.2.tar.gz w3m-upstream/0.5.2.zip |
Adding upstream version 0.5.2upstream/0.5.2
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -1,10 +1,14 @@ -/* $Id: url.c,v 1.89 2004/04/16 18:47:19 ukai Exp $ */ +/* $Id: url.c,v 1.95 2007/05/23 15:06:06 inu Exp $ */ #include "fm.h" +#ifndef __MINGW32_VERSION #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#else +#include <winsock.h> +#endif /* __MINGW32_VERSION */ #include <signal.h> #include <setjmp.h> @@ -31,6 +35,11 @@ #define write(a,b,c) write_s(a,b,c) #endif /* __WATT32__ */ +#ifdef __MINGW32_VERSION +#define write(a,b,c) send(a,b,c, 0) +#define close(fd) closesocket(fd) +#endif + #ifdef INET6 /* see rc.c, "dns_order" and dnsorders[] */ int ai_family_order_table[7][3] = { @@ -1453,7 +1462,8 @@ init_stream(URLFile *uf, int scheme, InputStream stream) uf->scheme = scheme; uf->encoding = ENC_7BIT; uf->is_cgi = FALSE; - uf->compression = 0; + uf->compression = CMP_NOCOMPRESS; + uf->content_encoding = CMP_NOCOMPRESS; uf->guess_type = NULL; uf->ext = NULL; uf->modtime = -1; @@ -1526,12 +1536,12 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, /* local CGI: POST */ uf.stream = newFileStream(localcgi_post(pu->real_file, pu->query, request, option->referer), - (void (*)())pclose); + (void (*)())fclose); else /* lodal CGI: GET */ uf.stream = newFileStream(localcgi_get(pu->real_file, pu->query, option->referer), - (void (*)())pclose); + (void (*)())fclose); if (uf.stream) { uf.is_cgi = TRUE; uf.scheme = pu->scheme = SCM_LOCAL_CGI; @@ -1693,9 +1703,8 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, SSL_write(sslh, tmp->ptr, tmp->length); else write(sock, tmp->ptr, tmp->length); -#ifdef HTTP_DEBUG - { - FILE *ff = fopen("zzrequest", "a"); + if(w3m_reqlog){ + FILE *ff = fopen(w3m_reqlog, "a"); if (sslh) fputs("HTTPS: request via SSL\n", ff); else @@ -1703,7 +1712,6 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, fwrite(tmp->ptr, sizeof(char), tmp->length, ff); fclose(ff); } -#endif /* HTTP_DEBUG */ if (hr->command == HR_COMMAND_POST && request->enctype == FORM_ENCTYPE_MULTIPART) { if (sslh) @@ -1717,13 +1725,11 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, #endif /* USE_SSL */ { write(sock, tmp->ptr, tmp->length); -#ifdef HTTP_DEBUG - { - FILE *ff = fopen("zzrequest", "a"); + if(w3m_reqlog){ + FILE *ff = fopen(w3m_reqlog, "a"); fwrite(tmp->ptr, sizeof(char), tmp->length, ff); fclose(ff); } -#endif /* HTTP_DEBUG */ if (hr->command == HR_COMMAND_POST && request->enctype == FORM_ENCTYPE_MULTIPART) write_from_file(sock, request->body); |