From b44e0618c89242200fef75b47d93c57b944cb24d Mon Sep 17 00:00:00 2001 From: oes Date: Thu, 17 May 2001 22:34:44 +0000 Subject: [PATCH] - Added hint on GIF char array generation to jcc.c - Cleaned CRLF's from the sources and related files - Repaired logging for REF and FRC --- jcc.c | 111 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 60 insertions(+), 51 deletions(-) diff --git a/jcc.c b/jcc.c index e6d06bd7..f167a8b8 100644 --- a/jcc.c +++ b/jcc.c @@ -1,7 +1,7 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.1 2001/05/13 21:57:06 administrator Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.1.1.1 2001/05/15 13:58:56 oes Exp $"; /********************************************************************* * - * File : $Source: /home/administrator/cvs/ijb/jcc.c,v $ + * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ * * Purpose : Main file. Contains main() method, main loop, and * the main connection-handling function. @@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.1 2001/05/13 21:57:06 administrator Exp $ * * Revisions : * $Log: jcc.c,v $ + * Revision 1.1.1.1 2001/05/15 13:58:56 oes + * Initial import of version 2.9.3 source tree + * * *********************************************************************/ @@ -158,11 +161,17 @@ static const char SHEADER[] = "HTTP/1.0 502 Invalid header received from server\n\n"; #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) + +/* + * Hint: You can encode your own GIFs like that: + * perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o,", unpack("C", $c)); }' + */ + static const char BLANKGIF[] = "HTTP/1.0 200 OK\r\n" "Pragma: no-cache\r\n" - "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" - "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" "Content-type: image/gif\r\n\r\n" "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000" "\000!\371\004\001\000\000\000\000,\000\000\000\000\001" @@ -171,8 +180,8 @@ static const char BLANKGIF[] = static const char JBGIF[] = "HTTP/1.0 200 OK\r\n" "Pragma: no-cache\r\n" - "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" - "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" "Content-type: image/gif\r\n\r\n" "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!" "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000" @@ -182,14 +191,14 @@ static const char JBGIF[] = "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305" "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276" "\037Q\000\000;"; - -static const char FWGIF[] = - "HTTP/1.0 302 Blocked Advert\r\n" - "Pragma: no-cache\r\n" - "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" - "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" - "Location: "; - + +static const char FWGIF[] = + "HTTP/1.0 302 Blocked Advert\r\n" + "Pragma: no-cache\r\n" + "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Expires: Thu Jul 31, 1997 07:42:22 pm GMT\r\n" + "Location: "; + #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */ #ifdef _WIN32 @@ -249,14 +258,14 @@ static void chat(struct client_state *csp) req = get_header(csp); - if (req == NULL) - { - break; /* no HTTP request! */ + if (req == NULL) + { + break; /* no HTTP request! */ } - if (*req == '\0') - { - continue; /* more to come! */ + if (*req == '\0') + { + continue; /* more to come! */ } #ifdef FORCE_LOAD @@ -267,7 +276,7 @@ static void chat(struct client_state *csp) if(strstr(req, FORCE_PREFIX)) { strclean(req, FORCE_PREFIX); - /* if DEBUG(FRC) fprintf(logfp, "%s: Enforcing request \"%s\".\n", prog, req); */ + log_error(LOG_LEVEL_FRC, "Enforcing request \"%s\".\n", req); csp->force = 1; } else @@ -458,11 +467,11 @@ static void chat(struct client_state *csp) { write_socket(csp->cfd, BLANKGIF, sizeof(BLANKGIF)-1); } - else if ((tinygif == 3) && (tinygifurl)) - { - write_socket(csp->cfd, FWGIF, sizeof(FWGIF)-1); - write_socket(csp->cfd, tinygifurl, strlen(tinygifurl)); - } + else if ((tinygif == 3) && (tinygifurl)) + { + write_socket(csp->cfd, FWGIF, sizeof(FWGIF)-1); + write_socket(csp->cfd, tinygifurl, strlen(tinygifurl)); + } else { write_socket(csp->cfd, JBGIF, sizeof(JBGIF)-1); @@ -1080,13 +1089,13 @@ static void listen_loop(void) if (!accept_connection(csp, bfd)) { log_error(LOG_LEVEL_CONNECT, "accept failed: %E"); - -#ifdef AMIGA - if(!childs) - { - exit(1); - } -#endif + +#ifdef AMIGA + if(!childs) + { + exit(1); + } +#endif continue; } else @@ -1141,24 +1150,24 @@ static void listen_loop(void) } #endif -#if defined(AMIGA) && !defined(SELECTED_ONE_OPTION) -#define SELECTED_ONE_OPTION - csp->cfd = ReleaseSocket(csp->cfd, -1); - if((child_id = (int)CreateNewProcTags( - NP_Entry, (ULONG)server_thread, - NP_Output, Output(), - NP_CloseOutput, FALSE, - NP_Name, (ULONG)"junkbuster child", - NP_StackSize, 20*1024, - TAG_DONE))) - { - childs++; - ((struct Task *)child_id)->tc_UserData = csp; - Signal((struct Task *)child_id, SIGF_SINGLE); - Wait(SIGF_SINGLE); - } -#endif - +#if defined(AMIGA) && !defined(SELECTED_ONE_OPTION) +#define SELECTED_ONE_OPTION + csp->cfd = ReleaseSocket(csp->cfd, -1); + if((child_id = (int)CreateNewProcTags( + NP_Entry, (ULONG)server_thread, + NP_Output, Output(), + NP_CloseOutput, FALSE, + NP_Name, (ULONG)"junkbuster child", + NP_StackSize, 20*1024, + TAG_DONE))) + { + childs++; + ((struct Task *)child_id)->tc_UserData = csp; + Signal((struct Task *)child_id, SIGF_SINGLE); + Wait(SIGF_SINGLE); + } +#endif + #if !defined(SELECTED_ONE_OPTION) child_id = fork(); #endif -- 2.39.2