Open Bug 204250 Opened 17 years ago Updated 3 years ago

Error attaching image from redirected http: There was a problem including the file ... in the message

Categories

(MailNews Core :: Composition, defect)

defect
Not set

Tracking

(Not tracked)

People

(Reporter: nbaca, Unassigned)

References

(Blocks 3 open bugs)

Details

(Keywords: regression, ux-consistency, Whiteboard: [STR comment 14])

Trunk build 2003-04-29: WinMe, Mac 10.1.5

Overview: Sending a message fails when attaching a web page that performs a
redirect (i.e. www.abcnews.com).

Steps to reproduce:
1. Create a new message
2. Select File|Attach and enter "http://www.abcnews.com"
3. Send the message

Actual Results: Send fails and reports the error There was a problem including
the file www.abcnews.com in the message. Would you like to continue sending this
 message without the file?"

In the browser go to "http://www.abcnews.com" and notice it is redirected to
"http://www.abcnews.go.com". If I send the message using this exact url
"www.abcnews.go.com" then sending is successful.

If I send a message to a url that does not redirect then sending is successful
(i.e. http://www.google.com)

Expected Results: Sending should succeed and it should not matter that the url
is redirected.
Marking nsbeta1 since sending fails and will be difficult for the user to
understand why it's failing.

This was working in N7.02 so it is a regression.
Assignee: ducarroz → sspitzer
Keywords: nsbeta1, regression
adt: nsbeta1-
Keywords: nsbeta1nsbeta1-
accepting, but not sure yet what to do about this.
Status: NEW → ASSIGNED
some info:

when there is a redirect going on, this happens:

>	necko.dll!nsHttpChannel::Cancel(unsigned int status=2152398851)  Line 2673	C++
 	necko.dll!nsHttpChannel::ProcessRedirection(unsigned int redirectType=302) 
Line 1873	C++
 	necko.dll!nsHttpChannel::ProcessResponse()  Line 684 + 0xc	C++
 	necko.dll!nsHttpChannel::OnStartRequest(nsIRequest * request=0x04a81d20,
nsISupports * ctxt=0x00000000)  Line 3459 + 0xb	C++
 	necko.dll!nsInputStreamPump::OnStateStart()  Line 377 + 0x2a	C++
 	necko.dll!nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *
stream=0x0494de54)  Line 333 + 0xb	C++
 	xpcom.dll!nsInputStreamReadyEvent::EventHandler(PLEvent * plevent=0x048d1614)
 Line 119	C++
 	xpcom.dll!PL_HandleEvent(PLEvent * self=0x048d1614)  Line 673 + 0xa	C
 	xpcom.dll!PL_ProcessPendingEvents(PLEventQueue * self=0x00a29f70)  Line 608
+ 0x9	C
 	xpcom.dll!_md_EventReceiverProc(HWND__ * hwnd=0x006e064a, unsigned int
uMsg=49764, unsigned int wParam=0, long lParam=10657648)  Line 1414 + 0x9	C
 	user32.dll!77d43a50() 	
 	user32.dll!77d43b1f() 	
 	user32.dll!77d43d79() 	
 	ntdll.dll!77f944a8() 	
 	user32.dll!77d43fd4() 	
 	user32.dll!77d43ddf() 	
 	gkwidget.dll!nsAppShell::Run()  Line 135	C++
 	appshell.dll!nsAppShellService::Run()  Line 524	C++
 	mozilla.exe!main1(int argc=2, char * * argv=0x002a3150, nsISupports *
nativeApp=0x009d0d58)  Line 1303 + 0x20	C++
 	mozilla.exe!main(int argc=2, char * * argv=0x002a3150)  Line 1780 + 0x25	C++
 	mozilla.exe!mainCRTStartup()  Line 398 + 0x11	C
 	kernel32.dll!77e814c7() 	
 	ntdll.dll!77f944a8() 	


note, that set mStatus to NS_BINDING_REDIRECTED

then later, we fail in the mail code:

 	msgcompo.dll!nsMsgAttachmentHandler::UrlExit(unsigned int status=2152398851,
const unsigned short * aMsg=0x00000000)  Line 1059	C++
 	msgcompo.dll!FetcherURLDoneCallback(unsigned int aStatus=2152398851, const
char * aContentType=0x00000000, const char * aCharset=0x00000000, int
totalSize=0, const unsigned short * aMsg=0x00000000, void * tagData=0x04889f9c)
 Line 481 + 0x10	C++
 	msgcompo.dll!nsURLFetcher::OnStopRequest(nsIRequest * request=0x049e7ed8,
nsISupports * ctxt=0x00000000, unsigned int aStatus=2152398851)  Line 318 + 0x32	C++
 	msgcompo.dll!nsURLFetcher::OnStateChange(nsIWebProgress *
aProgress=0x04a8faec, nsIRequest * aRequest=0x049e7ed8, unsigned int
aStateFlags=65552, unsigned int aStatus=2152398851)  Line 413	C++
 	docshell.dll!nsDocLoaderImpl::FireOnStateChange(nsIWebProgress *
aProgress=0x04a8faec, nsIRequest * aRequest=0x049e7ed8, int aStateFlags=65552,
unsigned int aStatus=2152398851)  Line 1249	C++
 	docshell.dll!nsDocLoaderImpl::doStopURLLoad(nsIRequest * request=0x049e7ed8,
unsigned int aStatus=2152398851)  Line 833	C++
 	docshell.dll!nsDocLoaderImpl::OnStopRequest(nsIRequest * aRequest=0x049e7ed8,
nsISupports * aCtxt=0x00000000, unsigned int aStatus=2152398851)  Line 699	C++
>	necko.dll!nsLoadGroup::RemoveRequest(nsIRequest * request=0x049e7ed8,
nsISupports * ctxt=0x00000000, unsigned int aStatus=2152398851)  Line 695 + 0x2c	C++
 	necko.dll!nsHttpChannel::OnStopRequest(nsIRequest * request=0x0493a7b0,
nsISupports * ctxt=0x00000000, unsigned int status=2152398851)  Line 3567	C++
 	necko.dll!nsInputStreamPump::OnStateStop()  Line 499	C++
 	necko.dll!nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *
stream=0x0493a6cc)  Line 339 + 0xb	C++
 	xpcom.dll!nsInputStreamReadyEvent::EventHandler(PLEvent * plevent=0x04992d2c)
 Line 119	C++
 	xpcom.dll!PL_HandleEvent(PLEvent * self=0x04992d2c)  Line 673 + 0xa	C
 	xpcom.dll!PL_ProcessPendingEvents(PLEventQueue * self=0x00a29f70)  Line 608
+ 0x9	C
 	xpcom.dll!_md_EventReceiverProc(HWND__ * hwnd=0x006e064a, unsigned int
uMsg=49764, unsigned int wParam=0, long lParam=10657648)  Line 1414 + 0x9	C
 	user32.dll!77d43a50() 	
 	user32.dll!77d43b1f() 	
 	user32.dll!77d43d79() 	
 	ntdll.dll!77f944a8() 	
 	user32.dll!77d43fd4() 	
 	user32.dll!77d43ddf() 	
 	gkwidget.dll!nsAppShell::Run()  Line 135	C++
 	appshell.dll!nsAppShellService::Run()  Line 524	C++
 	mozilla.exe!main1(int argc=2, char * * argv=0x002a3150, nsISupports *
nativeApp=0x009d0d58)  Line 1303 + 0x20	C++
 	mozilla.exe!main(int argc=2, char * * argv=0x002a3150)  Line 1780 + 0x25	C++
 	mozilla.exe!mainCRTStartup()  Line 398 + 0x11	C
 	kernel32.dll!77e814c7() 	
 	ntdll.dll!77f944a8() 	

I'm guessing nsURLFetcher needs to be made to handle redirects, instead of bailing.

see http://lxr.mozilla.org/mozilla/source/mailnews/compose/src/nsURLFetcher.cpp#403

darren, any suggestions?
Keywords: helpwanted
Product: MailNews → Core
sorry for the spam.  making bugzilla reflect reality as I'm not working on these bugs.  filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Status: ASSIGNED → NEW
Filter on "Nobody_NScomTLD_20080620"
QA Contact: esther → composition
Product: Core → MailNews Core
with background send disabled, I crashed after failed send, OK, ... bug 531262 - nsMsgAttachmentHandler::Abort()

with background send enabled, nothing is sent and no crash
Summary: Sending fails when attaching a web page that performs a redirect (i.e. www.abcnews.com) → Sending fails when attaching a web page that performs a redirect (i.e. www.abcnews.com) msg "There was a problem including the file ... in the message"
can anyone reproduce this in version 3 or 3.1?
Depends on: 531262
With SeaMonkey 2.0.7pre the mail gets sent, but contains only a page with the redirect message instead of the content of the actual page to which the redirect leads.
tony, can you reproduce?
should this move to SM?
Duplicate of this bug: 529255
Duplicate of this bug: 669054
Attaching a web page which performs a redirect fails nastily in every possible way, up to crashing TB.
Tested on TB17.0.8, WinXP

It would be highly useful to fix this as we'd probably also eliminate half of the bugs we keep getting for attached (inline) images (Bug 501298) which also occcur for copy and paste of web page parts with remote images.

STR (using POP account)

1) Compose new HTML msg
2) File > Attach > Web page... (or from attach button dropdown)
   Attach web page which redirects, e.g. http://www.google.com
3a) Save as draft
3b) Send
3c) Repeat steps 1-2, then:
    File > Send Later (or Ctrl+Shift+Enter)

Actual results:

3a) *Save as draft* fails with these error messages:
"There was a problem including the file www.google.com in the message. Would you like to continue saving the message without this file?" [OK][Cancel]
- [OK] will save msg as draft without web page
- [Cancel] will trigger another confusing error message (we have a bug for that):
"Unable to save your message as draft. Please verify that your Mail & Newsgroup account settings are correct and try again."

3b) *Send* silently sends msg without web page attachment.

3c) *Send later* crashes Thunderbird (Mozilla Crash Reporter: We're sorry Thunderbird had a problem and crashed")

Expected Result:

3a)b)c)
Attach a full copy of the web page without errors or crashes (including getting remote images that might have redirects again; perhaps we need to set a nested redirection level limit somewhere?)
Severity: normal → critical
Keywords: crash
Summary: Sending fails when attaching a web page that performs a redirect (i.e. www.abcnews.com) msg "There was a problem including the file ... in the message" → Crash, errors when attaching web page which redirects (e.g. www.google.com): Crash when "Send later"; attachment missing when "Send"; error msgs when "Save as draft": "There was a problem including the file ... in the message";"Unable...verify...settings"
Whiteboard: [STR comment 12]
Summary: Crash, errors when attaching web page which redirects (e.g. www.google.com): Crash when "Send later"; attachment missing when "Send"; error msgs when "Save as draft": "There was a problem including the file ... in the message";"Unable...verify...settings" → Crash, errors when attaching web page which redirects URL (e.g. www.google.com): "Send later" => crash; "Send" => attachment missing; "Save as draft" => error msgs: "There was a problem including the file ... in the message";"Unable...verify...settings"
ux-consistency: behaviour should be consistent (even just to show error message) for Save as draft, Send, Send later

ux-trust: crashes on a simple task like attaching web page undermine user's trust into TB
> occcur for copy and paste of web page parts with remote images

jorg, do your recent changes to attachment handling in compose help here?
Flags: needinfo?(jorgk)
Keywords: helpwanted, ux-trust
Whiteboard: [STR comment 12] → [STR comment 14]
(In reply to Wayne Mery (:wsmwk, NI for questions) from comment #16)
> jorg, do your recent changes to attachment handling in compose help here?
Actually, Magnus implemented most those changes. Sadly they don't help for images from http: sources which includes redirects as I noticed myself when looking at bug 1320873 recently, see bug 1320873 comment #3.
Flags: needinfo?(jorgk)
That said, I don't think there are any crashes, the image simply doesn't get attached.

I got an example from bug 1320873 comment #6:
https://gstatic.com/images/branding/googlelogo/2x/googlelogo_dark_color_84x28dp.png

Send/Save/Send later gives:
There was a problem including the file googlelogo_dark_color_84x28dp.png in the message. Would you like to continue saving the message without this file?
Summary: Crash, errors when attaching web page which redirects URL (e.g. www.google.com): "Send later" => crash; "Send" => attachment missing; "Save as draft" => error msgs: "There was a problem including the file ... in the message";"Unable...verify...settings" → Error attaching image from redirected http: There was a problem including the file ... in the message
Thanks for cleaning this up
Severity: critical → normal
Keywords: crash
Brief debugging session: nsMsgAttachmentHandler::SnarfAttachment() calls FireURLRequest(). That ends up in the callback FetcherURLDoneCallback() with totalSize==0, so it didn't get the attachment.

Looks like we'd have to implement some smarts to handle the redirect. Obviously in a 14 y/o bug no one ever felt up to it :-(  Given that viewing works, we know that the M-C display engine can handle it, but our simplistic "get the thing and attach it" can't.

Oh, stepping through a bit more into nsMsgAttachmentHandler::UrlExit(), we get to
  if (!m_size)
    status = NS_ERROR_FAILURE;
(which is Kent's new code from bug 453196 to stop the attachment hang) and we're done.
You need to log in before you can comment on or make changes to this bug.