Thu Jan 8 12:14:14 CST 2009 Pekka Pessi <first.last@nokia.com>
* http: use <sofia-sip/su_string.h> functions git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11793 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
85cafb105d
commit
5628845768
|
@ -1 +1 @@
|
|||
Wed Feb 11 10:45:40 CST 2009
|
||||
Wed Feb 11 10:46:12 CST 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 @@ 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 {
|
||||
|
|
|
@ -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 @@ 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=")) {
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue