winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
1233 discussions
Start a n
N
ew thread
Jacek Caban : jscript: Added lastIndex tests.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 35b2ca947c9fd2ed41f0bd881a7a224d25cb8306 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=35b2ca947c9fd2ed41f0bd881…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 21:12:29 2009 +0100 jscript: Added lastIndex tests. --- dlls/jscript/tests/regexp.js | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/dlls/jscript/tests/regexp.js b/dlls/jscript/tests/regexp.js index ff98b48..bcc9aba 100644 --- a/dlls/jscript/tests/regexp.js +++ b/dlls/jscript/tests/regexp.js @@ -298,4 +298,70 @@ ok(re === RegExp(re, undefined), "re !== RegExp(re, undefined)"); re = /abc/; ok(re === RegExp(re, undefined, 1), "re !== RegExp(re, undefined, 1)"); +re = /a/g; +ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex + " expected 0"); + +m = re.exec(" a "); +ok(re.lastIndex === 2, "re.lastIndex = " + re.lastIndex + " expected 2"); +ok(m.index === 1, "m.index = " + m.index + " expected 1"); + +m = re.exec(" a "); +ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex + " expected 0"); +ok(m === null, "m = " + m + " expected null"); + +re.lastIndex = 2; +m = re.exec(" a a "); +ok(re.lastIndex === 4, "re.lastIndex = " + re.lastIndex + " expected 4"); +ok(m.index === 3, "m.index = " + m.index + " expected 3"); + +re.lastIndex = "2"; +ok(re.lastIndex === "2", "re.lastIndex = " + re.lastIndex + " expected '2'"); +m = re.exec(" a a "); +ok(re.lastIndex === 4, "re.lastIndex = " + re.lastIndex + " expected 4"); +ok(m.index === 3, "m.index = " + m.index + " expected 3"); + +var li = 0; +var obj = new Object(); +obj.valueOf = function() { return li; }; + +re.lastIndex = obj; +ok(re.lastIndex === obj, "re.lastIndex = " + re.lastIndex + " expected obj"); +li = 2; +m = re.exec(" a a "); +ok(re.lastIndex === 2, "re.lastIndex = " + re.lastIndex + " expected 2"); +ok(m.index === 1, "m.index = " + m.index + " expected 1"); + +re.lastIndex = 3; +re.lastIndex = "test"; +ok(re.lastIndex === "test", "re.lastIndex = " + re.lastIndex + " expected 'test'"); +m = re.exec(" a a "); +ok(re.lastIndex === 2, "re.lastIndex = " + re.lastIndex + " expected 2"); +ok(m.index === 1, "m.index = " + m.index + " expected 1"); + +re.lastIndex = 0; +re.lastIndex = 3.9; +ok(re.lastIndex === 3.9, "re.lastIndex = " + re.lastIndex + " expected 3.9"); +m = re.exec(" a a "); +ok(re.lastIndex === 4, "re.lastIndex = " + re.lastIndex + " expected 4"); +ok(m.index === 3, "m.index = " + m.index + " expected 3"); + +obj.valueOf = function() { throw 0; } +re.lastIndex = obj; +ok(re.lastIndex === obj, "unexpected re.lastIndex"); +m = re.exec(" a a "); +ok(re.lastIndex === 2, "re.lastIndex = " + re.lastIndex + " expected 2"); +ok(m.index === 1, "m.index = " + m.index + " expected 1"); + +re.lastIndex = -3; +ok(re.lastIndex === -3, "re.lastIndex = " + re.lastIndex + " expected -3"); +m = re.exec(" a a "); +ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex + " expected 0"); +ok(m === null, "m = " + m + " expected null"); + +re.lastIndex = -1; +ok(re.lastIndex === -1, "re.lastIndex = " + re.lastIndex + " expected -1"); +m = re.exec(" "); +ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex + " expected 0"); +ok(m === null, "m = " + m + " expected null"); + reportSuccess();
1
0
0
0
Jacek Caban : jscript: Added lastIndex setter implementation.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: d0062198b6c56960285ce9a5a03c5a64a792d050 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d0062198b6c56960285ce9a5a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 21:12:13 2009 +0100 jscript: Added lastIndex setter implementation. --- dlls/jscript/regexp.c | 64 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 59 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index 6c4af84..0c8a419 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -32,6 +32,7 @@ */ #include <assert.h> +#include <math.h> #include "jscript.h" @@ -82,7 +83,8 @@ typedef struct { JSRegExp *jsregexp; BSTR str; - DWORD last_index; + INT last_index; + VARIANT last_index_var; } RegExpInstance; static const WCHAR sourceW[] = {'s','o','u','r','c','e',0}; @@ -3430,6 +3432,13 @@ HRESULT regexp_match(script_ctx_t *ctx, DispatchEx *dispex, const WCHAR *str, DW return S_OK; } +static void set_last_index(RegExpInstance *This, DWORD last_index) +{ + This->last_index = last_index; + VariantClear(&This->last_index_var); + num_set_val(&This->last_index_var, last_index); +} + static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { @@ -3474,6 +3483,27 @@ static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return E_NOTIMPL; } +static INT index_from_var(script_ctx_t *ctx, VARIANT *v) +{ + jsexcept_t ei; + VARIANT num; + HRESULT hres; + + memset(&ei, 0, sizeof(ei)); + hres = to_number(ctx, v, &ei, &num); + if(FAILED(hres)) { /* FIXME: Move ignoring exceptions to to_promitive */ + VariantClear(&ei.var); + return 0; + } + + if(V_VT(&num) == VT_R8) { + DOUBLE d = floor(V_R8(&num)); + return (DOUBLE)(INT)d == d ? d : 0; + } + + return V_I4(&num); +} + static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { @@ -3482,8 +3512,21 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, switch(flags) { case DISPATCH_PROPERTYGET: { RegExpInstance *regexp = regexp_from_vdisp(jsthis); - V_VT(retv) = VT_I4; - V_I4(retv) = regexp->last_index; + + V_VT(retv) = VT_EMPTY; + return VariantCopy(retv, ®exp->last_index_var); + } + case DISPATCH_PROPERTYPUT: { + RegExpInstance *regexp = regexp_from_vdisp(jsthis); + VARIANT *arg; + HRESULT hres; + + arg = get_arg(dp,0); + hres = VariantCopy(®exp->last_index_var, arg); + if(FAILED(hres)) + return hres; + + regexp->last_index = index_from_var(ctx, arg); break; } default: @@ -3589,6 +3632,13 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce return E_OUTOFMEMORY; } + if(regexp->last_index < 0) { + SysFreeString(string); + set_last_index(regexp, 0); + *ret = VARIANT_FALSE; + return S_OK; + } + length = SysStringLen(string); if(regexp->jsregexp->flags & JSREG_GLOB) last_index = regexp->last_index; @@ -3602,10 +3652,10 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce } if(hres == S_OK) { - regexp->last_index = cp-string; + set_last_index(regexp, cp-string); *ret = VARIANT_TRUE; }else { - regexp->last_index = 0; + set_last_index(regexp, 0); *ret = VARIANT_FALSE; } @@ -3690,6 +3740,7 @@ static void RegExp_destructor(DispatchEx *dispex) if(This->jsregexp) js_DestroyRegExp(This->jsregexp); + VariantClear(&This->last_index_var); SysFreeString(This->str); heap_free(This); } @@ -3764,6 +3815,9 @@ HRESULT create_regexp(script_ctx_t *ctx, const WCHAR *exp, int len, DWORD flags, return E_FAIL; } + V_VT(®exp->last_index_var) = VT_I4; + V_I4(®exp->last_index_var) = 0; + *ret = ®exp->dispex; return S_OK; }
1
0
0
0
Jacek Caban : wininet: Make HTTP_HttpSendRequestW static and avoid its forward declaration.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 34fcbb5f7502391424c65f9dd72c8d134d969d15 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=34fcbb5f7502391424c65f9dd…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 20:01:17 2009 +0100 wininet: Make HTTP_HttpSendRequestW static and avoid its forward declaration. --- dlls/wininet/http.c | 893 ++++++++++++++++++++++++----------------------- dlls/wininet/internet.h | 4 - 2 files changed, 447 insertions(+), 450 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=34fcbb5f7502391424c65…
1
0
0
0
Jacek Caban : wininet: Directly return error status from HTTP_HttpAddRequestHeadersW.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: e974965185e050d4d05ca20a1f51219a356d122b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e974965185e050d4d05ca20a1…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 20:01:00 2009 +0100 wininet: Directly return error status from HTTP_HttpAddRequestHeadersW. --- dlls/wininet/http.c | 88 ++++++++++++++++++++++----------------------------- 1 files changed, 38 insertions(+), 50 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 3b02297..5aceae5 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -200,9 +200,9 @@ static CRITICAL_SECTION authcache_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; static DWORD HTTP_OpenConnection(http_request_t *req); static BOOL HTTP_GetResponseHeaders(http_request_t *req, BOOL clear); -static BOOL HTTP_ProcessHeader(http_request_t *req, LPCWSTR field, LPCWSTR value, DWORD dwModifier); +static DWORD HTTP_ProcessHeader(http_request_t *req, LPCWSTR field, LPCWSTR value, DWORD dwModifier); static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer); -static BOOL HTTP_InsertCustomHeader(http_request_t *req, LPHTTPHEADERW lpHdr); +static DWORD HTTP_InsertCustomHeader(http_request_t *req, LPHTTPHEADERW lpHdr); static INT HTTP_GetCustomHeaderIndex(http_request_t *req, LPCWSTR lpszField, INT index, BOOL Request); static BOOL HTTP_DeleteCustomHeader(http_request_t *req, DWORD index); static LPWSTR HTTP_build_req( LPCWSTR *list, int len ); @@ -884,14 +884,13 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, /*********************************************************************** * HTTP_HttpAddRequestHeadersW (internal) */ -static BOOL HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, +static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier) { LPWSTR lpszStart; LPWSTR lpszEnd; LPWSTR buffer; - BOOL bSuccess = FALSE; - DWORD len; + DWORD len, res = ERROR_HTTP_INVALID_HEADER; TRACE("copying header: %s\n", debugstr_wn(lpszHeader, dwHeaderLength)); @@ -930,25 +929,25 @@ static BOOL HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, { /* Skip 0-length headers */ lpszStart = lpszEnd; - bSuccess = TRUE; + res = ERROR_SUCCESS; continue; } pFieldAndValue = HTTP_InterpretHttpHeader(lpszStart); if (pFieldAndValue) { - bSuccess = HTTP_VerifyValidHeader(lpwhr, pFieldAndValue[0]); - if (bSuccess) - bSuccess = HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], + res = HTTP_VerifyValidHeader(lpwhr, pFieldAndValue[0]); + if (res == ERROR_SUCCESS) + res = HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], pFieldAndValue[1], dwModifier | HTTP_ADDHDR_FLAG_REQ); HTTP_FreeTokens(pFieldAndValue); } lpszStart = lpszEnd; - } while (bSuccess); + } while (res == ERROR_SUCCESS); HeapFree(GetProcessHeap(), 0, buffer); - return bSuccess; + return res; } /*********************************************************************** @@ -970,8 +969,8 @@ static BOOL HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier) { - BOOL bSuccess = FALSE; http_request_t *lpwhr; + DWORD res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_wn(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier); @@ -979,17 +978,14 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, return TRUE; lpwhr = (http_request_t*) WININET_GetObject( hHttpRequest ); - if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) - { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - goto lend; - } - bSuccess = HTTP_HttpAddRequestHeadersW( lpwhr, lpszHeader, dwHeaderLength, dwModifier ); -lend: + if (lpwhr && lpwhr->hdr.htype == WH_HHTTPREQ) + res = HTTP_HttpAddRequestHeadersW( lpwhr, lpszHeader, dwHeaderLength, dwModifier ); if( lpwhr ) WININET_Release( &lpwhr->hdr ); - return bSuccess; + if(res != ERROR_SUCCESS) + SetLastError(res); + return res == ERROR_SUCCESS; } /*********************************************************************** @@ -4665,12 +4661,12 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) #define COALESCEFLAGS (HTTP_ADDHDR_FLAG_COALESCE|HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA|HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) -static BOOL HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR value, DWORD dwModifier) +static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR value, DWORD dwModifier) { LPHTTPHEADERW lphttpHdr = NULL; - BOOL bSuccess = FALSE; INT index = -1; BOOL request_only = dwModifier & HTTP_ADDHDR_FLAG_REQ; + DWORD res = ERROR_HTTP_INVALID_HEADER; TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier); @@ -4686,9 +4682,7 @@ static BOOL HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR val if (index >= 0) { if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) - { - return FALSE; - } + return ERROR_HTTP_INVALID_HEADER; lphttpHdr = &lpwhr->pCustHeaders[index]; } else if (value) @@ -4705,7 +4699,7 @@ static BOOL HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR val return HTTP_InsertCustomHeader(lpwhr, &hdr); } /* no value to delete */ - else return TRUE; + else return ERROR_SUCCESS; if (dwModifier & HTTP_ADDHDR_FLAG_REQ) lphttpHdr->wFlags |= HDR_ISREQUEST; @@ -4730,7 +4724,7 @@ static BOOL HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR val return HTTP_InsertCustomHeader(lpwhr, &hdr); } - return TRUE; + return ERROR_SUCCESS; } else if (dwModifier & COALESCEFLAGS) { @@ -4768,16 +4762,16 @@ static BOOL HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR val memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); lphttpHdr->lpszValue[len] = '\0'; - bSuccess = TRUE; + res = ERROR_SUCCESS; } else { WARN("HeapReAlloc (%d bytes) failed\n",len+1); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); + res = ERROR_OUTOFMEMORY; } } - TRACE("<-- %d\n",bSuccess); - return bSuccess; + TRACE("<-- %d\n", res); + return res; } @@ -4848,11 +4842,10 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *lpwhr, LPCWSTR lpszField, * Insert header into array * */ -static BOOL HTTP_InsertCustomHeader(http_request_t *lpwhr, LPHTTPHEADERW lpHdr) +static DWORD HTTP_InsertCustomHeader(http_request_t *lpwhr, LPHTTPHEADERW lpHdr) { INT count; LPHTTPHEADERW lph = NULL; - BOOL r = FALSE; TRACE("--> %s: %s\n", debugstr_w(lpHdr->lpszField), debugstr_w(lpHdr->lpszValue)); count = lpwhr->nCustHeaders + 1; @@ -4861,22 +4854,17 @@ static BOOL HTTP_InsertCustomHeader(http_request_t *lpwhr, LPHTTPHEADERW lpHdr) else lph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HTTPHEADERW) * count); - if (NULL != lph) - { - lpwhr->pCustHeaders = lph; - lpwhr->pCustHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField); - lpwhr->pCustHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue); - lpwhr->pCustHeaders[count-1].wFlags = lpHdr->wFlags; - lpwhr->pCustHeaders[count-1].wCount= lpHdr->wCount; - lpwhr->nCustHeaders++; - r = TRUE; - } - else - { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - } + if (!lph) + return ERROR_OUTOFMEMORY; - return r; + lpwhr->pCustHeaders = lph; + lpwhr->pCustHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField); + lpwhr->pCustHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue); + lpwhr->pCustHeaders[count-1].wFlags = lpHdr->wFlags; + lpwhr->pCustHeaders[count-1].wCount= lpHdr->wCount; + lpwhr->nCustHeaders++; + + return ERROR_SUCCESS; } @@ -4915,9 +4903,9 @@ static BOOL HTTP_VerifyValidHeader(http_request_t *lpwhr, LPCWSTR field) { /* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */ if (!strcmpW(lpwhr->lpszVersion, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding)) - return FALSE; + return ERROR_HTTP_INVALID_HEADER; - return TRUE; + return ERROR_SUCCESS; } /***********************************************************************
1
0
0
0
Jacek Caban : wininet: Directly return error status from HTTP_HttpOpenRequestW.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 85a057e1869ff5e43eb7cb5ff3ade4bc111f3f59 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=85a057e1869ff5e43eb7cb5ff…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 20:00:44 2009 +0100 wininet: Directly return error status from HTTP_HttpOpenRequestW. --- dlls/wininet/http.c | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 5309096..3b02297 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2530,10 +2530,10 @@ static const object_vtbl_t HTTPREQVtbl = { * NULL on failure * */ -static HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, - LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, - LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, - DWORD dwFlags, DWORD_PTR dwContext) +static DWORD HTTP_HttpOpenRequestW(http_session_t *lpwhs, + LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, + LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, + DWORD dwFlags, DWORD_PTR dwContext, HINTERNET *ret) { appinfo_t *hIC = NULL; http_request_t *lpwhr; @@ -2550,7 +2550,7 @@ static HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, lpwhr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(http_request_t)); if (NULL == lpwhr) { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); + res = ERROR_OUTOFMEMORY; goto lend; } lpwhr->hdr.htype = WH_HHTTPREQ; @@ -2571,14 +2571,14 @@ static HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, (strlenW(lpwhs->lpszHostName) + 7 /* length of ":65535" + 1 */)); if (NULL == lpszHostName) { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); + res = ERROR_OUTOFMEMORY; goto lend; } handle = WININET_AllocHandle( &lpwhr->hdr ); if (NULL == handle) { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); + res = ERROR_OUTOFMEMORY; goto lend; } @@ -2586,7 +2586,6 @@ static HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, { InternetCloseHandle( handle ); handle = NULL; - INTERNET_SetLastError(res); goto lend; } @@ -2665,7 +2664,8 @@ lend: WININET_Release( &lpwhr->hdr ); TRACE("<-- %p (%p)\n", handle, lpwhr); - return handle; + *ret = handle; + return res; } /*********************************************************************** @@ -2685,6 +2685,7 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, { http_session_t *lpwhs; HINTERNET handle = NULL; + DWORD res; TRACE("(%p, %s, %s, %s, %s, %p, %08x, %08lx)\n", hHttpSession, debugstr_w(lpszVerb), debugstr_w(lpszObjectName), @@ -2700,8 +2701,8 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, lpwhs = (http_session_t*) WININET_GetObject( hHttpSession ); if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - goto lend; + res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; + goto lend; } /* @@ -2711,13 +2712,15 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, * necessary HINTERNET pointer returned by this function. * */ - handle = HTTP_HttpOpenRequestW(lpwhs, lpszVerb, lpszObjectName, - lpszVersion, lpszReferrer, lpszAcceptTypes, - dwFlags, dwContext); + res = HTTP_HttpOpenRequestW(lpwhs, lpszVerb, lpszObjectName, + lpszVersion, lpszReferrer, lpszAcceptTypes, + dwFlags, dwContext, &handle); lend: if( lpwhs ) WININET_Release( &lpwhs->hdr ); TRACE("returning %p\n", handle); + if(res != ERROR_SUCCESS) + SetLastError(res); return handle; }
1
0
0
0
Jacek Caban : wininet: Make HTTP_HttpOpenRequestW static and avoid forward its declaration.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 47c71fcd0a465cad427ad5bbb56135f8ea98fd1b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47c71fcd0a465cad427ad5bbb…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 20:00:28 2009 +0100 wininet: Make HTTP_HttpOpenRequestW static and avoid forward its declaration. --- dlls/wininet/http.c | 109 +++++++++++++++++++++++------------------------ dlls/wininet/internet.h | 4 -- 2 files changed, 54 insertions(+), 59 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 5c504d4..5309096 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1177,60 +1177,6 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, } /*********************************************************************** - * HttpOpenRequestW (WININET.@) - * - * Open a HTTP request handle - * - * RETURNS - * HINTERNET a HTTP request handle on success - * NULL on failure - * - */ -HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, - LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, - LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, - DWORD dwFlags, DWORD_PTR dwContext) -{ - http_session_t *lpwhs; - HINTERNET handle = NULL; - - TRACE("(%p, %s, %s, %s, %s, %p, %08x, %08lx)\n", hHttpSession, - debugstr_w(lpszVerb), debugstr_w(lpszObjectName), - debugstr_w(lpszVersion), debugstr_w(lpszReferrer), lpszAcceptTypes, - dwFlags, dwContext); - if(lpszAcceptTypes!=NULL) - { - int i; - for(i=0;lpszAcceptTypes[i]!=NULL;i++) - TRACE("\taccept type: %s\n",debugstr_w(lpszAcceptTypes[i])); - } - - lpwhs = (http_session_t*) WININET_GetObject( hHttpSession ); - if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) - { - INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - goto lend; - } - - /* - * My tests seem to show that the windows version does not - * become asynchronous until after this point. And anyhow - * if this call was asynchronous then how would you get the - * necessary HINTERNET pointer returned by this function. - * - */ - handle = HTTP_HttpOpenRequestW(lpwhs, lpszVerb, lpszObjectName, - lpszVersion, lpszReferrer, lpszAcceptTypes, - dwFlags, dwContext); -lend: - if( lpwhs ) - WININET_Release( &lpwhs->hdr ); - TRACE("returning %p\n", handle); - return handle; -} - - -/*********************************************************************** * HttpOpenRequestA (WININET.@) * * Open a HTTP request handle @@ -2584,7 +2530,7 @@ static const object_vtbl_t HTTPREQVtbl = { * NULL on failure * */ -HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, +static HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext) @@ -2722,6 +2668,59 @@ lend: return handle; } +/*********************************************************************** + * HttpOpenRequestW (WININET.@) + * + * Open a HTTP request handle + * + * RETURNS + * HINTERNET a HTTP request handle on success + * NULL on failure + * + */ +HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, + LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, + LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, + DWORD dwFlags, DWORD_PTR dwContext) +{ + http_session_t *lpwhs; + HINTERNET handle = NULL; + + TRACE("(%p, %s, %s, %s, %s, %p, %08x, %08lx)\n", hHttpSession, + debugstr_w(lpszVerb), debugstr_w(lpszObjectName), + debugstr_w(lpszVersion), debugstr_w(lpszReferrer), lpszAcceptTypes, + dwFlags, dwContext); + if(lpszAcceptTypes!=NULL) + { + int i; + for(i=0;lpszAcceptTypes[i]!=NULL;i++) + TRACE("\taccept type: %s\n",debugstr_w(lpszAcceptTypes[i])); + } + + lpwhs = (http_session_t*) WININET_GetObject( hHttpSession ); + if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) + { + INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); + goto lend; + } + + /* + * My tests seem to show that the windows version does not + * become asynchronous until after this point. And anyhow + * if this call was asynchronous then how would you get the + * necessary HINTERNET pointer returned by this function. + * + */ + handle = HTTP_HttpOpenRequestW(lpwhs, lpszVerb, lpszObjectName, + lpszVersion, lpszReferrer, lpszAcceptTypes, + dwFlags, dwContext); +lend: + if( lpwhs ) + WININET_Release( &lpwhs->hdr ); + TRACE("returning %p\n", handle); + return handle; +} + /* read any content returned by the server so that the connection can be * reused */ static void HTTP_DrainContent(http_request_t *req) diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index b9612b2..a29cb45 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -414,10 +414,6 @@ LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen); BOOLAPI HTTP_HttpSendRequestW(http_request_t *req, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwContentLength, BOOL bEndRequest); -INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *session, - LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, - LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, - DWORD dwFlags, DWORD_PTR dwContext); VOID SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo,
1
0
0
0
Jacek Caban : wininet: Directly return error status from NETCON_init.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: b01d58428b2c38f1b594064d7028e43a75885103 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b01d58428b2c38f1b594064d7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 20:00:11 2009 +0100 wininet: Directly return error status from NETCON_init. --- dlls/wininet/http.c | 11 ++++++++--- dlls/wininet/internet.h | 2 +- dlls/wininet/netconnection.c | 27 ++++++++++----------------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 6a45ea4..5c504d4 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2594,7 +2594,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, LPWSTR lpszHostName = NULL; HINTERNET handle = NULL; static const WCHAR szHostForm[] = {'%','s',':','%','u',0}; - DWORD len; + DWORD len, res; TRACE("-->\n"); @@ -2636,10 +2636,11 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(http_session_t *lpwhs, goto lend; } - if (!NETCON_init(&lpwhr->netConnection, dwFlags & INTERNET_FLAG_SECURE)) + if ((res = NETCON_init(&lpwhr->netConnection, dwFlags & INTERNET_FLAG_SECURE)) != ERROR_SUCCESS) { InternetCloseHandle( handle ); handle = NULL; + INTERNET_SetLastError(res); goto lend; } @@ -3694,7 +3695,11 @@ static BOOL HTTP_HandleRedirect(http_request_t *lpwhr, LPCWSTR lpszUrl) INTERNET_SetLastError(res); return FALSE; } - if (!NETCON_init(&lpwhr->netConnection, lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)) return FALSE; + res = NETCON_init(&lpwhr->netConnection, lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE); + if (res != ERROR_SUCCESS) { + INTERNET_SetLastError(res); + return FALSE; + } lpwhr->read_pos = lpwhr->read_size = 0; lpwhr->read_chunked = FALSE; } diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 75cd676..b9612b2 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -428,7 +428,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwStatusInfoLength); BOOL NETCON_connected(WININET_NETCONNECTION *connection); -BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL); +DWORD NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL); void NETCON_unload(void); DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain, int type, int protocol); diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 013789b..1f95dcb 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -163,7 +163,7 @@ static void ssl_lock_callback(int mode, int type, const char *file, int line) #endif -BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) +DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) { connection->useSSL = FALSE; connection->socketFD = -1; @@ -177,25 +177,23 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) if (OpenSSL_ssl_handle) /* already initialized everything */ { LeaveCriticalSection(&init_ssl_cs); - return TRUE; + return ERROR_SUCCESS; } OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0); if (!OpenSSL_ssl_handle) { ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBSSL); - INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); LeaveCriticalSection(&init_ssl_cs); - return FALSE; + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; } OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0); if (!OpenSSL_crypto_handle) { ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBCRYPTO); - INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); LeaveCriticalSection(&init_ssl_cs); - return FALSE; + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; } /* mmm nice ugly macroness */ @@ -204,9 +202,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) if (!p##x) \ { \ ERR("failed to load symbol %s\n", #x); \ - INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \ LeaveCriticalSection(&init_ssl_cs); \ - return FALSE; \ + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; \ } DYNSSL(SSL_library_init); @@ -234,9 +231,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) if (!p##x) \ { \ ERR("failed to load symbol %s\n", #x); \ - INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \ LeaveCriticalSection(&init_ssl_cs); \ - return FALSE; \ + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; \ } DYNCRYPTO(BIO_new_fp); DYNCRYPTO(CRYPTO_num_locks); @@ -257,9 +253,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) { ERR("SSL_CTX_set_default_verify_paths failed: %s\n", pERR_error_string(pERR_get_error(), 0)); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); LeaveCriticalSection(&init_ssl_cs); - return FALSE; + return ERROR_OUTOFMEMORY; } pCRYPTO_set_id_callback(ssl_thread_id); @@ -267,9 +262,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) pCRYPTO_num_locks() * sizeof(CRITICAL_SECTION)); if (!ssl_locks) { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); LeaveCriticalSection(&init_ssl_cs); - return FALSE; + return ERROR_OUTOFMEMORY; } for (i = 0; i < pCRYPTO_num_locks(); i++) InitializeCriticalSection(&ssl_locks[i]); @@ -277,11 +271,10 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) LeaveCriticalSection(&init_ssl_cs); #else FIXME("can't use SSL, not compiled in.\n"); - INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); - return FALSE; + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; #endif } - return TRUE; + return ERROR_SUCCESS; } void NETCON_unload(void)
1
0
0
0
Jacek Caban : wininet: Directly return error status from refill_buffer.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 1d96e20e8ab3bc6e1e8787c05d30954b6af0f3f3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d96e20e8ab3bc6e1e8787c05…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 19:59:56 2009 +0100 wininet: Directly return error status from refill_buffer. --- dlls/wininet/http.c | 58 ++++++++++++++++++++++++++------------------------ 1 files changed, 30 insertions(+), 28 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 2ab2d37..6a45ea4 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2016,7 +2016,7 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, } /* read some more data into the read buffer (the read section must be held) */ -static BOOL read_more_data( http_request_t *req, int maxlen ) +static DWORD read_more_data( http_request_t *req, int maxlen ) { DWORD res; int len; @@ -2033,13 +2033,10 @@ static BOOL read_more_data( http_request_t *req, int maxlen ) res = NETCON_recv( &req->netConnection, req->read_buf + req->read_size, maxlen - req->read_size, 0, &len ); - if(res != ERROR_SUCCESS) { - INTERNET_SetLastError(res); - return FALSE; - } + if(res == ERROR_SUCCESS) + req->read_size += len; - req->read_size += len; - return TRUE; + return res; } /* remove some amount of data from the read buffer (the read section must be held) */ @@ -2052,6 +2049,7 @@ static void remove_data( http_request_t *req, int count ) static BOOL read_line( http_request_t *req, LPSTR buffer, DWORD *len ) { int count, bytes_read, pos = 0; + DWORD res; EnterCriticalSection( &req->read_section ); for (;;) @@ -2071,11 +2069,12 @@ static BOOL read_line( http_request_t *req, LPSTR buffer, DWORD *len ) remove_data( req, bytes_read ); if (eol) break; - if (!read_more_data( req, -1 ) || !req->read_size) + if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS || !req->read_size) { *len = 0; TRACE( "returning empty string\n" ); LeaveCriticalSection( &req->read_section ); + INTERNET_SetLastError(res); return FALSE; } } @@ -2092,8 +2091,10 @@ static BOOL read_line( http_request_t *req, LPSTR buffer, DWORD *len ) } /* discard data contents until we reach end of line (the read section must be held) */ -static BOOL discard_eol( http_request_t *req ) +static DWORD discard_eol( http_request_t *req ) { + DWORD res; + do { BYTE *eol = memchr( req->read_buf + req->read_pos, '\n', req->read_size ); @@ -2103,21 +2104,21 @@ static BOOL discard_eol( http_request_t *req ) break; } req->read_pos = req->read_size = 0; /* discard everything */ - if (!read_more_data( req, -1 )) return FALSE; + if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res; } while (req->read_size); - return TRUE; + return ERROR_SUCCESS; } /* read the size of the next chunk (the read section must be held) */ -static BOOL start_next_chunk( http_request_t *req ) +static DWORD start_next_chunk( http_request_t *req ) { - DWORD chunk_size = 0; + DWORD chunk_size = 0, res; - if (!req->dwContentLength) return TRUE; + if (!req->dwContentLength) return ERROR_SUCCESS; if (req->dwContentLength == req->dwContentRead) { /* read terminator for the previous chunk */ - if (!discard_eol( req )) return FALSE; + if ((res = discard_eol( req )) != ERROR_SUCCESS) return res; req->dwContentLength = ~0u; req->dwContentRead = 0; } @@ -2134,16 +2135,15 @@ static BOOL start_next_chunk( http_request_t *req ) TRACE( "reading %u byte chunk\n", chunk_size ); req->dwContentLength = chunk_size; req->dwContentRead = 0; - if (!discard_eol( req )) return FALSE; - return TRUE; + return discard_eol( req ); } remove_data( req, 1 ); } - if (!read_more_data( req, -1 )) return FALSE; + if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res; if (!req->read_size) { req->dwContentLength = req->dwContentRead = 0; - return TRUE; + return ERROR_SUCCESS; } } } @@ -2158,21 +2158,22 @@ static BOOL end_of_read_data( http_request_t *req ) } /* fetch some more data into the read buffer (the read section must be held) */ -static BOOL refill_buffer( http_request_t *req ) +static DWORD refill_buffer( http_request_t *req ) { int len = sizeof(req->read_buf); + DWORD res; if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) { - if (!start_next_chunk( req )) return FALSE; + if ((res = start_next_chunk( req )) != ERROR_SUCCESS) return res; } if (req->dwContentLength != ~0u) len = min( len, req->dwContentLength - req->dwContentRead ); - if (len <= req->read_size) return TRUE; + if (len <= req->read_size) return ERROR_SUCCESS; - if (!read_more_data( req, len )) return FALSE; + if ((res = read_more_data( req, len )) != ERROR_SUCCESS) return res; if (!req->read_size) req->dwContentLength = req->dwContentRead = 0; - return TRUE; + return ERROR_SUCCESS; } static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync, int *read_ret) @@ -2186,7 +2187,7 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync, while(read < size && !req->gzip_stream->end_of_data) { if(!req->read_size) { - if(!sync || !refill_buffer(req)) + if(!sync || refill_buffer(req) != ERROR_SUCCESS) break; } @@ -2249,16 +2250,17 @@ static DWORD get_avail_data( http_request_t *req ) static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif) { INTERNET_ASYNC_RESULT iar; + DWORD res; TRACE("%p\n", req); EnterCriticalSection( &req->read_section ); - if (refill_buffer( req )) { + if ((res = refill_buffer( req )) == ERROR_SUCCESS) { iar.dwResult = (DWORD_PTR)req->hdr.hInternet; iar.dwError = first_notif ? 0 : get_avail_data(req); }else { iar.dwResult = 0; - iar.dwError = INTERNET_GetLastError(); + iar.dwError = res; } LeaveCriticalSection( &req->read_section ); @@ -2277,7 +2279,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD * if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) { - if (!start_next_chunk( req )) goto done; + if (start_next_chunk( req ) != ERROR_SUCCESS) goto done; } if(req->gzip_stream) {
1
0
0
0
Jacek Caban : wininet: Directly return error status from NETCON_recv.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 358e7b7c8aa12b6ba7db0dfb8af5edfb2174bfea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=358e7b7c8aa12b6ba7db0dfb8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Nov 30 19:59:40 2009 +0100 wininet: Directly return error status from NETCON_recv. --- dlls/wininet/http.c | 10 +++++++--- dlls/wininet/internet.h | 2 +- dlls/wininet/netconnection.c | 17 ++++++----------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index e4b6f1c..2ab2d37 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2018,6 +2018,7 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, /* read some more data into the read buffer (the read section must be held) */ static BOOL read_more_data( http_request_t *req, int maxlen ) { + DWORD res; int len; if (req->read_pos) @@ -2030,9 +2031,12 @@ static BOOL read_more_data( http_request_t *req, int maxlen ) if (maxlen == -1) maxlen = sizeof(req->read_buf); - if(!NETCON_recv( &req->netConnection, req->read_buf + req->read_size, - maxlen - req->read_size, 0, &len )) + res = NETCON_recv( &req->netConnection, req->read_buf + req->read_size, + maxlen - req->read_size, 0, &len ); + if(res != ERROR_SUCCESS) { + INTERNET_SetLastError(res); return FALSE; + } req->read_size += len; return TRUE; @@ -2304,7 +2308,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD * if (size > bytes_read && (!bytes_read || sync)) { if (NETCON_recv( &req->netConnection, (char *)buffer + bytes_read, size - bytes_read, - sync ? MSG_WAITALL : 0, &len)) + sync ? MSG_WAITALL : 0, &len) == ERROR_SUCCESS) bytes_read += len; /* always return success, even if the network layer returns an error */ } diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 04a4a65..75cd676 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -438,7 +438,7 @@ DWORD NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *s DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname); DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags, int *sent /* out */); -BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, +DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, int *recvd /* out */); BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available); LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection); diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 36599e9..013789b 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -584,30 +584,25 @@ DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len * Basically calls 'recv()' unless we should use SSL * number of chars received is put in *recvd */ -BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, +DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, int *recvd /* out */) { *recvd = 0; - if (!NETCON_connected(connection)) return FALSE; + if (!NETCON_connected(connection)) return ERROR_INTERNET_CONNECTION_ABORTED; if (!len) - return TRUE; + return ERROR_SUCCESS; if (!connection->useSSL) { *recvd = recv(connection->socketFD, buf, len, flags); - if (*recvd == -1) - { - INTERNET_SetLastError(sock_get_error(errno)); - return FALSE; - } - return TRUE; + return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS; } else { #ifdef SONAME_LIBSSL *recvd = pSSL_read(connection->ssl_s, buf, len); - return *recvd > 0 || !len; + return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED; #else - return FALSE; + return ERROR_NOT_SUPPORTED; #endif } }
1
0
0
0
Andrew Eikum : mshtml: Add stub implementation of IHTMLFormElement.
by Alexandre Julliard
01 Dec '09
01 Dec '09
Module: wine Branch: master Commit: 1563c137fa8a5f0ad08e73f2a7d37371490f726e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1563c137fa8a5f0ad08e73f2a…
Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Mon Nov 30 11:40:06 2009 -0600 mshtml: Add stub implementation of IHTMLFormElement. --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/dispex.c | 2 + dlls/mshtml/htmlelem.c | 3 + dlls/mshtml/htmlform.c | 380 ++++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 3 + dlls/mshtml/nsiface.idl | 27 +++- dlls/mshtml/tests/dom.c | 22 ++- 7 files changed, 434 insertions(+), 4 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=1563c137fa8a5f0ad08e7…
1
0
0
0
← Newer
1
...
118
119
120
121
122
123
124
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Results per page:
10
25
50
100
200