myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-247


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-247-g56a82e2
Date: Sun, 23 May 2010 11:36:13 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  56a82e2184951621173a8cd3d1a41fe4fac379c7 (commit)
      from  446475f1bd09d6dc3c392e1833a29e3b1a66b541 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 56a82e2184951621173a8cd3d1a41fe4fac379c7
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun May 23 12:33:09 2010 +0200

    Properly capitalize HTTP response header.

diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 0f51a53..f1258ea 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -89,7 +89,13 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   for (; it != response->other.end (); it++)
     {
       HttpResponseHeader::Entry *e = *it;
+      char *old_pos = pos;
       pos += myserver_strlcpy (pos, e->name.c_str (), MAX - (long)(pos - str));
+      *old_pos = toupper (*old_pos);
+      while (old_pos++ != pos)
+        if (*(old_pos - 1) == '-')
+          *old_pos = toupper (*old_pos);
+
       pos += myserver_strlcpy (pos, ": ", MAX - (long)(pos - str));
       pos += myserver_strlcpy (pos, e->value.c_str (), MAX - (long)(pos - 
str));
       pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
@@ -349,19 +355,19 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
   validRequest = validHTTPRequest (input, inputSize, &nLines, &maxTotchars);
 
   /* Invalid header.  */
-  if (validRequest!=200)
-  {
-    /* Incomplete header.  */
-    if (validRequest==-1)
-      return -1;
-    /* Keep trace of first line for logging. */
-    tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
-    if (tokenOff > 0)
-      request->uri.assign ( input, min (HTTP_REQUEST_URI_DIM, tokenOff) );
-    else
-      request->uri.assign (input, HTTP_REQUEST_URI_DIM );
-    return validRequest;
-  }
+  if (validRequest != 200)
+    {
+      /* Incomplete header.  */
+      if (validRequest == -1)
+        return -1;
+      /* Keep trace of first line for logging. */
+      tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
+      if (tokenOff > 0)
+        request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, tokenOff));
+      else
+        request->uri.assign (input, HTTP_REQUEST_URI_DIM);
+      return validRequest;
+    }
 
   /* Get the first token, this is the HTTP command.*/
   tokenOff = getCharInString (token, cmdSeps, HTTP_REQUEST_CMD_DIM);
@@ -371,9 +377,9 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
       /* Keep trace of first line for logging.  */
       tokenOff = getEndLine (token, HTTP_REQUEST_URI_DIM);
       if (tokenOff > 0)
-        request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, tokenOff) );
+        request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, tokenOff));
       else
-        request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+        request->uri.assign (input, HTTP_REQUEST_URI_DIM);
     }
 
   do
@@ -416,7 +422,7 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
               if (tokenOff > 0)
                 request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff));
               else
-                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM);
               return 400;
             }
           if (tokenOff > maxUri)
@@ -425,12 +431,12 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
               request->cmd.clear ();
               tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
               if (tokenOff > 0)
-                request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff) );
+                request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff));
               else
-                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM);
               return 400;
             }
-          max = (int)tokenOff;
+          max = (int) tokenOff;
           while ((token[max] != ' ') && (lenToken - max < 
HTTP_REQUEST_VER_DIM))
             max--;
 
@@ -529,7 +535,7 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
                 request->uri.assign (input, min (HTTP_REQUEST_URI_DIM,
                                                  tokenOff));
               else
-                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM);
               return 400;
             }
 

-----------------------------------------------------------------------

Summary of changes:
 myserver/src/protocol/http/http_headers.cpp |   46 +++++++++++++++-----------
 1 files changed, 26 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]