[xiph-cvs] cvs commit: vorbis-tools/ogg123 http_transport.c
Stan Seibert
volsung at xiph.org
Wed Aug 6 16:14:12 PDT 2003
volsung 03/08/06 19:14:12
Modified: ogg123 http_transport.c
Log:
HTTP header fixes:
- Use correct syntax for representing the version number in the User
Agent string
- Specify the content types accepted by ogg123
Closes bug 280.
Revision Changes Path
1.12 +19 -2 vorbis-tools/ogg123/http_transport.c
Index: http_transport.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/http_transport.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- http_transport.c 17 Jul 2002 12:12:18 -0000 1.11
+++ http_transport.c 6 Aug 2003 23:14:12 -0000 1.12
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: http_transport.c,v 1.11 2002/07/17 12:12:18 calc Exp $
+ last mod: $Id: http_transport.c,v 1.12 2003/08/06 23:14:12 volsung Exp $
********************************************************************/
@@ -46,6 +46,7 @@
pthread_t curl_thread;
CURL *curl_handle;
+ struct curl_slist *header_list;
char error[CURL_ERROR_SIZE];
data_source_t *data_source;
@@ -117,7 +118,8 @@
curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, private);
curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0);
- curl_easy_setopt(handle, CURLOPT_USERAGENT, "ogg123 "VERSION);
+ curl_easy_setopt(handle, CURLOPT_USERAGENT, "ogg123/"VERSION);
+ curl_easy_setopt(handle, CURLOPT_HTTPHEADER, private->header_list);
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1);
}
@@ -150,6 +152,9 @@
curl_easy_cleanup(myarg->curl_handle);
myarg->curl_handle = 0;
+ curl_slist_free_all(myarg->header_list);
+ myarg->header_list = NULL;
+
return (void *) ret;
}
@@ -193,6 +198,7 @@
}
private->curl_handle = NULL;
+ private->header_list = NULL;
private->data_source = source;
private->stats.transfer_rate = 0;
private->stats.bytes_read = 0;
@@ -204,6 +210,15 @@
exit(1);
}
+ /* ogg123 only accepts Ogg files, and optionally FLAC as well */
+#ifdef HAVE_LIBFLAC
+ private->header_list = curl_slist_append(NULL, "Accept: application/ogg audio/x-flac;q=0.9");
+#else
+ private->header_list = curl_slist_append(NULL, "Accept: application/ogg");
+#endif
+ if (private->header_list == NULL)
+ goto fail;
+
/* Open URL */
private->curl_handle = curl_easy_init();
if (private->curl_handle == NULL)
@@ -228,6 +243,8 @@
fail:
if (private->curl_handle != NULL)
curl_easy_cleanup(private->curl_handle);
+ if (private->header_list != NULL)
+ curl_slist_free_all(private->header_list);
free(source->source_string);
free(private);
free(source);
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list