瀏覽代碼

nghttp2: $nghttp2(url) replaced with $nghttp2(path)

- match corresponding http2 header name
Daniel-Constantin Mierla 1 年之前
父節點
當前提交
7fb5156223
共有 3 個文件被更改,包括 8 次插入13 次删除
  1. 5 10
      src/modules/nghttp2/nghttp2_mod.c
  2. 2 2
      src/modules/nghttp2/nghttp2_server.c
  3. 1 1
      src/modules/nghttp2/nghttp2_server.h

+ 5 - 10
src/modules/nghttp2/nghttp2_mod.c

@@ -186,15 +186,10 @@ int pv_parse_nghttp2_name(pv_spec_p sp, str *in)
 	if(sp == NULL || in == NULL || in->len <= 0)
 	if(sp == NULL || in == NULL || in->len <= 0)
 		return -1;
 		return -1;
 	switch(in->len) {
 	switch(in->len) {
-		case 3:
-			if(strncasecmp(in->s, "url", 3) == 0) {
-				sp->pvp.pvn.u.isname.name.n = 0;
-			} else {
-				goto error;
-			}
-			break;
 		case 4:
 		case 4:
-			if(strncasecmp(in->s, "data", 4) == 0) {
+			if(strncasecmp(in->s, "path", 4) == 0) {
+				sp->pvp.pvn.u.isname.name.n = 0;
+			} else if(strncasecmp(in->s, "data", 4) == 0) {
 				sp->pvp.pvn.u.isname.name.n = 1;
 				sp->pvp.pvn.u.isname.name.n = 1;
 			} else if(strncasecmp(in->s, "size", 4) == 0) {
 			} else if(strncasecmp(in->s, "size", 4) == 0) {
 				sp->pvp.pvn.u.isname.name.n = 2;
 				sp->pvp.pvn.u.isname.name.n = 2;
@@ -264,8 +259,8 @@ int pv_get_nghttp2(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
 	}
 	}
 
 
 	switch(param->pvn.u.isname.name.n) {
 	switch(param->pvn.u.isname.name.n) {
-		case 0: /* url */
-			return pv_get_strval(msg, param, res, &_ksr_nghttp2_ctx.url);
+		case 0: /* path */
+			return pv_get_strval(msg, param, res, &_ksr_nghttp2_ctx.path);
 		case 1: /* data */
 		case 1: /* data */
 			return pv_get_strval(msg, param, res, &_ksr_nghttp2_ctx.data);
 			return pv_get_strval(msg, param, res, &_ksr_nghttp2_ctx.data);
 		case 2: /* size */
 		case 2: /* size */

+ 2 - 2
src/modules/nghttp2/nghttp2_server.c

@@ -494,8 +494,8 @@ static int on_request_recv(nghttp2_session *session,
 	_ksr_nghttp2_ctx.session_data = session_data;
 	_ksr_nghttp2_ctx.session_data = session_data;
 	_ksr_nghttp2_ctx.stream_data = stream_data;
 	_ksr_nghttp2_ctx.stream_data = stream_data;
 
 
-	_ksr_nghttp2_ctx.url.s = stream_data->request_path;
-	_ksr_nghttp2_ctx.url.len = strlen(_ksr_nghttp2_ctx.url.s);
+	_ksr_nghttp2_ctx.path.s = stream_data->request_path;
+	_ksr_nghttp2_ctx.path.len = strlen(_ksr_nghttp2_ctx.path.s);
 
 
 	_ksr_nghttp2_ctx.srcip.s = session_data->client_addr;
 	_ksr_nghttp2_ctx.srcip.s = session_data->client_addr;
 	_ksr_nghttp2_ctx.srcip.len = strlen(_ksr_nghttp2_ctx.srcip.s);
 	_ksr_nghttp2_ctx.srcip.len = strlen(_ksr_nghttp2_ctx.srcip.s);

+ 1 - 1
src/modules/nghttp2/nghttp2_server.h

@@ -98,7 +98,7 @@ typedef struct ksr_nghttp2_ctx
 	nghttp2_nv rplhdrs_v[KSR_NGHTTP2_RPLHDRS_SIZE];
 	nghttp2_nv rplhdrs_v[KSR_NGHTTP2_RPLHDRS_SIZE];
 	int rplhdrs_n;
 	int rplhdrs_n;
 	str method;
 	str method;
-	str url;
+	str path;
 	str httpversion;
 	str httpversion;
 	str data;
 	str data;
 	char srcipbuf[IP_ADDR_MAX_STR_SIZE];
 	char srcipbuf[IP_ADDR_MAX_STR_SIZE];