### Description
In python (using module app_python3), in the xhttp module event callback
(ksr_xhttp_event):
```
KSR.xhttp.xhttp_reply(400, "Bad Request", "", "")
return 1
```
When this code is processed, Kamailio logs the following errors:
```
6(247453) ERROR: <core> [core/parser/parse_fline.c:272]: parse_first_line():
parse_first_line: bad message (offset: 16)
6(247453) ERROR: <core> [core/parser/msg_parser.c:749]: parse_msg(): ERROR:
parse_msg: message=<HTTP/1.1 400 Bad Request
Sia: SIP/2.0/TCP 127.0.0.1:41706
Server: kamailio (5.7.1 (x86_64/linux))
Content-Length: 0
6(247453) ERROR: <core>
[core/msg_translator.c:3256]: build_sip_msg_from_buf(): parsing failed
```
(The correct HTTP reply is sent back to the client, so the issue is only with these
logs.)
<br>
In kamailio script, in event_route[xhttp:request]:
```
xhttp_reply("400", "Bad Request", "", "");
exit;
```
In this case, there are no errors in Kamailio logs.
The two should be equivalent, but when using python we get errors when trying to send a
specific HTTP reply.
<br
When using python, if calling "KSR.jsonrpcs.dispatch()" for an unknown method,
we get the same errors in Kamailio logs:
```
6(253511) ERROR: <core> [core/parser/parse_fline.c:272]: parse_first_line():
parse_first_line: bad message (offset: 19)
6(253511) ERROR: <core> [core/parser/msg_parser.c:749]: parse_msg(): ERROR:
parse_msg: message=<HTTP/1.1 500 Method Not Found
Sia: SIP/2.0/TCP 127.0.0.1:59048
Content-Type: application/json
Server: kamailio (5.7.1 (x86_64/linux))
Content-Length: 84
{
"jsonrpc": "2.0",
"error": {
"code": 500,
"message": "Method Not Found"
}
}
6(253511) ERROR: <core>
[core/msg_translator.c:3256]: build_sip_msg_from_buf(): parsing failed
```
When the method is correct (client receives a HTTP 200), there are no errors in Kamailio
logs.
<br
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.7.1 (x86_64/linux) 4238e4
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST,
DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC,
DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER,
USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535,
DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 4238e4
compiled on 16:52:41 Aug 24 2023 with gcc 8.5.0
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3549
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3549(a)github.com