]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Thu Jan 8 12:14:14 CST 2009 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Wed, 11 Feb 2009 16:46:25 +0000 (16:46 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 11 Feb 2009 16:46:25 +0000 (16:46 +0000)
  * http: use <sofia-sip/su_string.h> functions

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11793 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
libs/sofia-sip/libsofia-sip-ua/http/http_parser.c

index 13a99ffa9878a345cba567499608b7852bda9ff3..cb23ab2f0b782627a6b9e82e7c8bafc6462a3c35 100644 (file)
@@ -1 +1 @@
-Wed Feb 11 10:45:40 CST 2009
+Wed Feb 11 10:46:12 CST 2009
index f93adf7d1628b6be185904211b1df8fd7c9f6aa1..2cfcd94a568782b92d76f54963f506af459c3e70 100644 (file)
@@ -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 @@ issize_t http_content_range_d(su_home_t *home, http_header_t *h, char *s, isize_
 {
   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 @@ issize_t http_if_range_d(su_home_t *home, http_header_t *h, char *s, isize_t sle
 {
   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 {
index 898ed3a0c89fa7737632fc882d26c5ebc7230933..ff6bef2caa44e271ef78a42fc420e8fc0b9fdb46 100644 (file)
 
 #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
 
 #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 @@ static issize_t set_cookie_scanner(char *s)
   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=")) {
index fe4bba289730c1e6082f97cb36d0c50c180d7d47..629ebe0a0ac358c36d0f78fac1d1d6198393c475 100644 (file)
@@ -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 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
         */
        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 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
     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 @@ int http_version_d(char **ss, char const **ver)
   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 @@ int http_version_d(char **ss, char const **ver)
       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 @@ http_method_t http_method_d(char **ss, char const **nname)
   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';