我正在使用这个简单的代码。
#include "gwan.h"
int main(int argc, char *argv[])
{
xbuf_t *reply = get_reply(argv), *read_buff;
read_buff = (xbuf_t*)get_env(argv, READ_XBUF);
xbuf_cat(reply, "START\n"); xbuf_ncat(reply, read_buff->ptr, read_buff->len); xbuf_cat(reply, "END\n");
// this line is important if I don't use read_buff everything seems OK
// but I need parse read_buff :(
printf("%s\n", read_buff->ptr); // this line is most important
return 200;
}
起初一切似乎都很好
shell:~$ for I in seq 0 1
; 做 curl -A "" -H "TST: ${I}" ' http://test.com:8080/?read_buf.c&scp=3 '; 完毕
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 1
END
再次执行我的循环
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 1
END
再次执行我的循环
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 1
END
但有我的问题。哪里 TST 仍然是 0 ?
再次执行我的循环
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
再次执行我的循环
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
START
GET /?read_buf.cscp=3HTTP/1.1
Host: test.com8080
Accept: */*
TST: 0
END
为什么?由于缓存?如何禁用它?
PS:servlet 在 G-WAN 4.3.14 上执行