Hi, list.
Writing http_header_pack function I get strange behavour for
some web sites.
1)
GET /img/eslogo0P.wbmp HTTP/1.1
Host: wap.eurosport.com
Accept: text/html
Accept: image/vnd.wap.wbmp
Works.
2)
GET /img/eslogo0P.wbmp HTTP/1.1
Host: wap.eurosport.com
Accept: text/html, image/vnd.wap.wbmp
Works.
3)
GET /img/eslogo0P.wbmp HTTP/1.1
Host: wap.eurosport.com
Accept: text/html,
image/vnd.wap.wbmp
HTTP/1.1 406 No acceptable objects were found
Server: Microsoft-IIS/5.0
--skipped--
As I undestand from HTTP specification all 3 requests are completly
equivalent. And my http_header_pack realization make 1->3
translation.
So question is: do I misundestand specifications or something else?
P.S.
http_header_pack realization (http.c):
static int http_header_cmp(void *a, void *b) {
Octstr *header,*pat;
header = a;
pat = b;
if (octstr_ncompare(header, pat, octstr_len(pat)) == 0) {
return 1;
}
return 0;
}
void http_header_pack(List *headers)
{
List *new_headers;
Octstr *curr,*name,*value;
int i;
gwlib_assert_init();
gw_assert(headers != NULL);
new_headers = http_create_empty_headers();
for (i = 0; i < list_len(headers); i++) {
http_header_get(headers, i, &name, &value);
if ((curr = list_search(new_headers, name, http_header_cmp)) == NULL) {
http_header_add(new_headers, octstr_get_cstr(name), octstr_get_cstr(value));
} else {
octstr_append_cstr(curr,",\r\n ");
octstr_append(curr,value);
}
octstr_destroy(name);
octstr_destroy(value);
}
http_header_combine(headers, new_headers);
http_destroy_headers(new_headers);
}
--
Vjacheslav Chekushin mailto:[EMAIL PROTECTED]
Latvian Mobile Phone Company http://www.lmt.lv