From dd02a73fcf0ebfd09989ac04cde013ae4ff2cce6 Mon Sep 17 00:00:00 2001 From: Dai Sato Date: Sun, 10 Dec 2006 10:49:23 +0000 Subject: add LiveHTTPHeaders-like option: -reqlog. --- ChangeLog | 8 +++++++- file.c | 8 +++----- fm.h | 4 ++-- main.c | 9 +++++++-- url.c | 14 +++++--------- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37f252d..e0aab04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-12-10 noz + + * [20051124052846@w3mbbs] LiveHTTPHeaders + * file.c, fm.h, main.c, url.c: add -reqlog option which makes + ~/.w3m/request.log like LiveHTTPHeaders of FireFox. + 2006-08-07 Fumitoshi UKAI * mailcap.c (acceptableMimeTypes): change default accept: line @@ -8754,4 +8760,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.969 2006/08/07 03:10:26 ukai Exp $ +$Id: ChangeLog,v 1.970 2006/12/10 10:49:23 inu Exp $ diff --git a/file.c b/file.c index d6d415d..883ee09 100644 --- a/file.c +++ b/file.c @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.246 2006/06/12 11:51:59 inu Exp $ */ +/* $Id: file.c,v 1.247 2006/12/10 10:49:23 inu Exp $ */ #include "fm.h" #include #include "myctype.h" @@ -614,14 +614,12 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) if (uf->scheme == SCM_NEWS && tmp->ptr[0] == '.') Strshrinkfirst(tmp, 1); #endif -#ifdef HTTP_DEBUG - { + if(w3m_reqlog){ FILE *ff; - ff = fopen("zzrequest", "a"); + ff = fopen(w3m_reqlog, "a"); Strfputs(tmp, ff); fclose(ff); } -#endif /* HTTP_DEBUG */ if (src) Strfputs(tmp, src); cleanup_line(tmp, HEADER_MODE); diff --git a/fm.h b/fm.h index bd8d65b..984d935 100644 --- a/fm.h +++ b/fm.h @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.131 2006/04/08 11:33:16 inu Exp $ */ +/* $Id: fm.h,v 1.132 2006/12/10 10:49:23 inu Exp $ */ /* * w3m: WWW wo Miru utility * @@ -870,7 +870,7 @@ global DownloadList *LastDL init(NULL); global int CurrentKey; global char *CurrentKeyData; global char *CurrentCmdData; - +global char *w3m_reqlog; extern char *w3m_version; #define DUMP_BUFFER 0x01 diff --git a/main.c b/main.c index b11913f..5f82970 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.252 2006/05/29 12:42:22 inu Exp $ */ +/* $Id: main.c,v 1.253 2006/12/10 10:49:23 inu Exp $ */ #define MAINPROGRAM #include "fm.h" #include @@ -249,6 +249,7 @@ fusage(FILE * f, int err) fprintf(f, " -config file specify config file\n"); fprintf(f, " -help print this usage message\n"); fprintf(f, " -version print w3m version\n"); + fprintf(f, " -reqlog write request logfile\n"); fprintf(f, " -debug DO NOT USE\n"); if (show_params_p) show_params(f); @@ -725,8 +726,12 @@ main(int argc, char **argv, char **envp) else if (!strcmp("-dummy", argv[i])) { /* do nothing */ } - else if (!strcmp("-debug", argv[i])) + else if (!strcmp("-debug", argv[i])) { w3m_debug = TRUE; + } + else if (!strcmp("-reqlog",argv[i])) { + w3m_reqlog=rcFile("request.log"); + } else { usage(); } diff --git a/url.c b/url.c index 86c2d47..61d5168 100644 --- a/url.c +++ b/url.c @@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.93 2006/05/29 12:54:26 inu Exp $ */ +/* $Id: url.c,v 1.94 2006/12/10 10:49:23 inu Exp $ */ #include "fm.h" #include #include @@ -1694,9 +1694,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 @@ -1704,7 +1703,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) @@ -1718,13 +1716,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); -- cgit v1.2.3