[Freeswitch-svn] [commit] r11793 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/http

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:46:25 PST 2009


Author: mikej
Date: Wed Feb 11 10:46:25 2009
New Revision: 11793

Log:
Thu Jan  8 12:14:14 CST 2009  Pekka Pessi <first.last at nokia.com>
  * http: use <sofia-sip/su_string.h> functions



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 10:46:25 2009
@@ -1 +1 @@
-Wed Feb 11 10:45:40 CST 2009
+Wed Feb 11 10:46:12 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	Wed Feb 11 10:46:25 2009
@@ -42,6 +42,7 @@
 #define MSG_HDR_T union http_header_u
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 
 #include <sofia-sip/http_parser.h>
 #include <sofia-sip/http_header.h>
@@ -52,7 +53,6 @@
 
 #include <stddef.h>
 #include <stdlib.h>
-#include <string.h>
 #include <assert.h>
 #include <stdio.h>
 #include <limits.h>
@@ -446,7 +446,7 @@
 {
   http_content_range_t *cr = h->sh_content_range;
 
-  if (strncasecmp(s, "bytes", 5))
+  if (!su_casenmatch(s, "bytes", 5))
     return -1;
   s += 5; skip_lws(&s);
   if (s[0] == '*') {
@@ -820,7 +820,7 @@
 {
   http_if_range_t *ifr = (http_if_range_t *)h;
 
-  if (s[0] == '"' || strncasecmp(s, "W/\"", 3) == 0) {
+  if (s[0] == '"' || su_casenmatch(s, "W/\"", 3)) {
     ifr->ifr_tag = s;
     return 0;
   } else {

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c	Wed Feb 11 10:46:25 2009
@@ -33,12 +33,7 @@
 
 #include "config.h"
 
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
+#include <sofia-sip/su_string.h>
 
 /* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t  */
 #define MSG_PUB_T struct http_s
@@ -46,6 +41,12 @@
 
 #include "sofia-sip/http_parser.h"
 
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <assert.h>
+
 /* ========================================================================== */
 
 /**@HTTP_HEADER http_proxy_connection Proxy-Connection extension header. */
@@ -348,7 +349,7 @@
   char *rest;
 
 #define LOOKING_AT(s, what) \
-  (strncasecmp((s), what, strlen(what)) == 0 && (rest = s + strlen(what)))
+  (su_casenmatch((s), what, strlen(what)) && (rest = s + strlen(what)))
 
   /* Special cases from Netscape spec */
   if (LOOKING_AT(s, "expires=")) {

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c	Wed Feb 11 10:46:25 2009
@@ -38,6 +38,7 @@
 #define MSG_HDR_T union http_header_u
 
 #include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
 #include "sofia-sip/http_parser.h"
 #include <sofia-sip/msg_parser.h>
 #include <sofia-sip/http_header.h>
@@ -48,7 +49,6 @@
 
 #include <stddef.h>
 #include <stdlib.h>
-#include <string.h>
 #include <stdio.h>
 #include <assert.h>
 #include <limits.h>
@@ -143,8 +143,7 @@
 	 */
 	http->http_transfer_encoding->k_items &&
 	http->http_transfer_encoding->k_items[0] &&
-	strcasecmp(http->http_transfer_encoding->k_items[0],
-		   "identity") != 0) {
+	!su_casematch(http->http_transfer_encoding->k_items[0], "identity")) {
       http->http_flags |= MSG_FLG_CHUNKS;
 
       if (http->http_flags & MSG_FLG_STREAMING)
@@ -162,8 +161,7 @@
     body_len = http->http_content_length->l_length;
   /* We cannot parse multipart/byteranges ... */
   else if (http->http_content_type && http->http_content_type->c_type &&
-	   strcasecmp(http->http_content_type->c_type, "multipart/byteranges")
-	   == 0)
+	   su_casematch(http->http_content_type->c_type, "multipart/byteranges"))
     return -1;
   else if (MSG_IS_MAILBOX(flags)) /* message fragments */
     body_len = 0;
@@ -312,12 +310,12 @@
   char const *result;
   int const version_size = sizeof(http_version_1_1) - 1;
 
-  if (strncasecmp(s, http_version_1_1, version_size) == 0 &&
+  if (su_casenmatch(s, http_version_1_1, version_size) &&
       !IS_TOKEN(s[version_size])) {
     result = http_version_1_1;
     s += version_size;
   }
-  else if (strncasecmp(s, http_version_1_0, version_size) == 0 &&
+  else if (su_casenmatch(s, http_version_1_0, version_size) &&
 	   !IS_TOKEN(s[version_size])) {
     result = http_version_1_0;
     s += version_size;
@@ -349,9 +347,9 @@
       s[l1 + 1 + l2] = 0;
 
       /* Compare again with compacted version */
-      if (strcasecmp(s, http_version_1_1) == 0)
+      if (su_casematch(s, http_version_1_1))
 	result = http_version_1_1;
-      else if (strcasecmp(s, http_version_1_0) == 0)
+      else if (su_casematch(s, http_version_1_0))
 	result = http_version_1_0;
     }
 
@@ -452,7 +450,7 @@
   int code = http_method_unknown;
   size_t n = 0;
 
-#define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0)
+#define MATCH(s, m) (su_casenmatch(s, m, n = sizeof(m) - 1))
 
   if (c >= 'a' && c <= 'z')
     c += 'A' - 'a';



More information about the Freeswitch-svn mailing list