mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Don't write the Content-Length header ourselves, WinHttpSendRequest()
2008-08-13 Tor Lillqvist <tml@novell.com> * win32/gwinhttpfileoutputstream.c (g_winhttp_file_output_stream_write): Don't write the Content-Length header ourselves, WinHttpSendRequest() takes care of that when the dwTotalLength parameter is non-zero. Increment offset by the number of actual bytes sent, although I wonder if such a scenario is possible where less than requested would be sent and accepted by the server without errors. svn path=/trunk/; revision=7345
This commit is contained in:
parent
7261372b45
commit
af8ebc9e55
@ -1,3 +1,13 @@
|
|||||||
|
2008-08-13 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* win32/gwinhttpfileoutputstream.c
|
||||||
|
(g_winhttp_file_output_stream_write): Don't write the
|
||||||
|
Content-Length header ourselves, WinHttpSendRequest() takes care
|
||||||
|
of that when the dwTotalLength parameter is non-zero. Increment
|
||||||
|
offset by the number of actual bytes sent, although I wonder if
|
||||||
|
such a scenario is possible where less than requested would be
|
||||||
|
sent and accepted by the server without errors.
|
||||||
|
|
||||||
2008-08-13 Tor Lillqvist <tml@novell.com>
|
2008-08-13 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* win32/gwinhttpvfs.c
|
* win32/gwinhttpvfs.c
|
||||||
|
@ -142,9 +142,8 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
headers = g_strdup_printf ("Content-Range: bytes %" G_GINT64_FORMAT "-%" G_GINT64_FORMAT "/*\r\n"
|
headers = g_strdup_printf ("Content-Range: bytes %" G_GINT64_FORMAT "-%" G_GINT64_FORMAT "/*\r\n",
|
||||||
"Content-Length: %" G_GSIZE_FORMAT "\r\n",
|
winhttp_stream->offset, winhttp_stream->offset + count);
|
||||||
winhttp_stream->offset, winhttp_stream->offset + count, count);
|
|
||||||
wheaders = g_utf8_to_utf16 (headers, -1, NULL, NULL, NULL);
|
wheaders = g_utf8_to_utf16 (headers, -1, NULL, NULL, NULL);
|
||||||
g_free (headers);
|
g_free (headers);
|
||||||
|
|
||||||
@ -152,7 +151,7 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
|
|||||||
(request,
|
(request,
|
||||||
wheaders, -1,
|
wheaders, -1,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
0,
|
count,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
char *emsg = _g_winhttp_error_message (GetLastError ());
|
char *emsg = _g_winhttp_error_message (GetLastError ());
|
||||||
@ -168,7 +167,6 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
winhttp_stream->offset += count;
|
|
||||||
g_free (wheaders);
|
g_free (wheaders);
|
||||||
|
|
||||||
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpWriteData
|
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpWriteData
|
||||||
@ -185,6 +183,8 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winhttp_stream->offset += bytes_written;
|
||||||
|
|
||||||
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpReceiveResponse
|
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpReceiveResponse
|
||||||
(request, NULL))
|
(request, NULL))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user