]> code.citadel.org Git - citadel.git/commitdiff
* Keep track of the HTTP "Host:" header being sent by the browser.
authorArt Cancro <ajc@citadel.org>
Tue, 13 Aug 2002 19:55:12 +0000 (19:55 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 13 Aug 2002 19:55:12 +0000 (19:55 +0000)
  (We're going to need this in the near future)

webcit/ChangeLog
webcit/mainmenu.c
webcit/webcit.c
webcit/webcit.h

index 136104f536ccd4e789e9a6e50fefb312ca6fc034..bca847901649b006f062ae85cf2ff5cac2561bcf 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 323.56  2002/08/13 19:55:12  ajc
+* Keep track of the HTTP "Host:" header being sent by the browser.
+  (We're going to need this in the near future)
+
 Revision 323.55  2002/08/05 16:07:30  ajc
 * Moved "edit floor label pic" to the floor editing screen
 
@@ -890,4 +894,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index f357e469ffde14edf6447bce5581bb4c50939887..2957e6db441f4e533d25230d391e6169aa516374 100644 (file)
@@ -216,8 +216,10 @@ void display_generic(void)
        wprintf("<INPUT TYPE=\"text\" NAME=\"g_cmd\" SIZE=80 MAXLENGTH=\"250\"><BR>\n");
 
        wprintf("Command input (if requesting SEND_LISTING transfer mode):<BR>\n");
-       wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA>\n");
+       wprintf("<TEXTAREA NAME=\"g_input\" ROWS=10 COLS=80 WIDTH=80></TEXTAREA><BR>\n");
 
+       wprintf("<FONT SIZE=-2>Detected host header is http://%s</FONT>\n",
+               WC->http_host);
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Send command\">");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
 
index 6a20cf870b571cf0879c0a4b98113b6c42d7667f..8b713a7b52a4bc94b06322df882606eed8acdfb5 100644 (file)
@@ -824,10 +824,13 @@ void session_loop(struct httprequest *req)
                        ContentLength = atoi(&buf[16]);
                }
                else if (!strncasecmp(buf, "Content-type: ", 14)) {
-                       strcpy(ContentType, &buf[14]);
+                       safestrncpy(ContentType, &buf[14], sizeof ContentType);
                }
                else if (!strncasecmp(buf, "User-agent: ", 12)) {
-                       strcpy(user_agent, &buf[12]);
+                       safestrncpy(user_agent, &buf[12], sizeof user_agent);
+               }
+               else if (!strncasecmp(buf, "Host: ", 6)) {
+                       safestrncpy(WC->http_host, &buf[6], sizeof WC->http_host);
                }
                /* Only WAP gateways explicitly name this content-type */
                else if (strstr(buf, "text/vnd.wap.wml")) {
index 2d64e9262c441869c88cf899af5dd172e1e69c9f..2f9ece12ab417a1813f882275efc308e5d834de3 100644 (file)
@@ -151,8 +151,9 @@ struct wcsession {
        struct urlcontent *urlstrings;
        int HaveExpressMessages;        /* Nonzero if incoming msgs exist */
        struct wcsubst *vars;
-       char *preferences;
        char this_page[SIZ];            /* address of current page */
+       char http_host[SIZ];            /* HTTP Host: header */
+       char *preferences;
 };
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')