Changeset 3067:b395e36e014a in roaraudio for libroar/vio_proto.c
- Timestamp:
- 12/28/09 01:24:41 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_proto.c
r3066 r3067 187 187 if ( count == 0 ) 188 188 return have; 189 190 ROAR_DBG("roar_vio_proto_read(*): have=%lli, count=%lli", (long long int)have, (long long int)count); 189 191 190 192 if ( (ret = roar_vio_read(self->next, buf, count)) == -1 ) … … 253 255 254 256 int roar_vio_open_proto_http (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file) { 255 char buf[1024]; 257 struct roar_vio_proto * self; 258 struct roar_buffer * bufbuf; 259 char * buf; 260 char * endofheader = NULL; 256 261 char b0[80], b1[80]; 257 262 int status; … … 263 268 return -1; 264 269 270 self = calls->inst; 265 271 calls->write = NULL; // Disable write as we do not support this 272 273 if ( roar_buffer_new(&bufbuf, 1024) == -1 ) 274 return -1; 275 276 if ( roar_buffer_get_data(bufbuf, &buf) == -1 ) { 277 roar_buffer_free(bufbuf); 278 return -1; 279 } 266 280 267 281 ROAR_DBG("roar_vio_open_proto_http(calls=%p, dst=%p, host='%s', file='%s') = ?", calls, dst, host, file); … … 281 295 if ( (len = roar_vio_read(dst, buf, 1023)) < 1 ) { 282 296 ROAR_DBG("roar_vio_open_proto_http(*) = -1"); 297 roar_buffer_free(bufbuf); 283 298 return -1; 284 299 } … … 290 305 if ( sscanf(buf, "%79s %i %79s\n", b0, &status, b1) != 3 ) { 291 306 ROAR_DBG("roar_vio_open_proto_http(*) = -1"); 307 roar_buffer_free(bufbuf); 292 308 return -1; 293 309 } … … 297 313 if ( status != 200 ) { 298 314 ROAR_DBG("roar_vio_open_proto_http(*) = -1 // status=%i", status); 315 roar_buffer_free(bufbuf); 299 316 return -1; 300 317 } … … 303 320 // ROAR_WARN("roar_vio_open_proto_http(*): buf='%s'", buf); 304 321 322 endofheader = strstr(buf, "\r\n\r\n"); 323 324 ROAR_DBG("roar_vio_open_proto_http(*): endofheader=%p\n", endofheader); 325 326 while ( endofheader == NULL ) { 327 if ( (len = roar_vio_read(dst, buf, 1023)) < 1 ) 328 return -1; 329 330 buf[len] = 0; 331 endofheader = strstr(buf, "\r\n\r\n"); 332 ROAR_DBG("roar_vio_open_proto_http(*): endofheader=%p\n", endofheader); 333 } 334 335 ROAR_DBG("roar_vio_open_proto_http(*): endofheader=%p\n", endofheader); 336 ROAR_DBG("roar_vio_open_proto_http(*): buf=%p\n", buf); 337 338 if ( (endofheader - buf) == (len - 4) ) { 339 roar_buffer_free(bufbuf); 340 bufbuf = NULL; 341 } 342 343 if ( bufbuf != NULL ) { 344 roar_buffer_set_offset(bufbuf, endofheader - buf + 4); 345 roar_buffer_set_len(bufbuf, 1024 - (endofheader - buf + 4) - 1); 346 } 347 self->reader.buffer = bufbuf; 348 349 /* 305 350 if ( !strcmp((buf+len)-4, "\r\n\r\n") ) 306 351 return 0; … … 310 355 return -1; 311 356 } 357 */ 312 358 313 359 return 0;
Note: See TracChangeset
for help on using the changeset viewer.