Project

General

Profile

Bug #4353 » debug1.patch

Jaroslav Kysela, 2017-10-31 12:06

View differences:

src/httpc.c
1026 1026
  }
1027 1027

  
1028 1028
  if (hc->hc_rsize < r + hc->hc_rpos) {
1029
    if (hc->hc_rsize + r > hc->hc_io_size + 20*1024)
1029
    if (hc->hc_rsize + r > hc->hc_io_size + 20*1024) {
1030
      tvhtrace(LS_HTTPC, "%04X: overflow, buf %zd read %zd io %zd", shortid(hc), hc->hc_rsize, r, hc->hc_io_size);
1031
      tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16);
1030 1032
      return http_client_flush(hc, -EMSGSIZE);
1033
    }
1031 1034
    hc->hc_rsize += r;
1032 1035
    hc->hc_rbuf = realloc(hc->hc_rbuf, hc->hc_rsize + 1);
1033 1036
  }
1037
  tvhtrace(LS_HTTPC, "%04X: new data %zd", shortid(hc), r);
1034 1038
  memcpy(hc->hc_rbuf + hc->hc_rpos, buf, r);
1035 1039
  hc->hc_rpos += r;
1036 1040

  
......
1135 1139
  r = 0;
1136 1140
  hc->hc_in_data = 0;
1137 1141
  hc->hc_in_rtp_data = 0;
1142
  tvhtrace(LS_HTTPC, "%04X: rtsp data %zd", shortid(hc), hc->hc_rpos);
1138 1143
  while (hc->hc_rpos > r + 3) {
1139 1144
    if (hc->hc_rbuf[r] != '$')
1140 1145
      break;
1141 1146
    hc->hc_csize = 4 + ((hc->hc_rbuf[r+2] << 8) | hc->hc_rbuf[r+3]);
1147
    tvhtrace(LS_HTTPC, "%04X: rtsp data chunk %zd", shortid(hc), hc->hc_csize);
1142 1148
    hc->hc_chunked = 0;
1143 1149
    if (r + hc->hc_csize > hc->hc_rpos) {
1144 1150
      http_client_rbuf_cut(hc, r);
1145 1151
      hc->hc_in_rtp_data = 1;
1152
      tvhtrace(LS_HTTPC, "%04X: rtsp data incomplete %zd", shortid(hc), r);
1153
      tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16);
1146 1154
      if (r == 0)
1147 1155
        goto retry;
1148 1156
      return HTTP_CON_RECEIVING;
......
1156 1164
      if (res < 0)
1157 1165
        return res;
1158 1166
    }
1167
    tvhtrace(LS_HTTPC, "%04X: rtsp data cont %zd", shortid(hc), hc->hc_csize);
1159 1168
    r += hc->hc_csize;
1160 1169
    hc->hc_in_rtp_data = 1;
1161 1170
    hc->hc_code = 0;
......
1166 1175
  }
1167 1176
  if (r > 0) {
1168 1177
    http_client_rbuf_cut(hc, r);
1178
    tvhtrace(LS_HTTPC, "%04X: rtsp data next header %zd (cut %zd)", shortid(hc), hc->hc_rpos, r);
1179
    tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16);
1169 1180
    goto next_header;
1170 1181
  }
1171 1182
  return HTTP_CON_RECEIVING;
(2-2/2)