#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>
#include <stddef.h>
#include <stdlib.h>
-#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <limits.h>
{
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] == '*') {
{
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 {
#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. */
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=")) {
#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>
#include <stddef.h>
#include <stdlib.h>
-#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
*/
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)
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;
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;
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;
}
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';