Summary:ASTERISK-16009: [patch] Provisioning failure
Reporter:Christian Jacobsen (cjacobsen)Labels:
Date Opened:2010-04-23 18:52:48Date Closed:2010-06-15 16:10:16
Versions:Frequency of
Environment:Attachments:( 0) patch1.diff
( 1) patch2.diff
Description:Cut off 1 character at the end of output because there are two newlines between http headers and content. Content-length is ok.


i had test it with polycom phones (650 and 330)
Comments:By: Leif Madsen (lmadsen) 2010-04-26 12:53:50

Any chance the issue you're seeing is related to ASTERISK-15498 ?

By: Leif Madsen (lmadsen) 2010-04-26 12:55:17

Can you just elaborate on what you're fixing? (i.e. what is broken when this has not been fixed?) -- it'll be useful to know when the commit msg is generated. Thanks!

By: Andrew Latham (lathama) 2010-04-26 12:58:32

This was an issue with the content length not matching the http header and some phones did not like the files.  Used wget and telnet to find the issue. Telnet would pull the whole file and wget would only read to the end of the defined content length.  Christian "wawi" Jacobsen found this and many others.  I am helping him learn how to use the bug system and code submissions.

By: Andrew Latham (lathama) 2010-04-26 13:02:22

In 1.6.2 the phoneprov worked, in trunk it was broken.  Wawi found that the content and the content length header did not match. He removed a line return and it started working.  There may be a better fix for this but this is what we are using in an installation for ~ 430 users.  :)

By: Christian Jacobsen (cjacobsen) 2010-04-27 11:44:04

for static files, the file is sent "twice" because this code:

447                 while ((len = read(fd, buf, sizeof(buf))) > 0) {
448                         if (fwrite(buf, 1, len, ser->f) != len) {
449                                 if (errno != EPIPE) {
450                                         ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
451                                 } else {
452                                         ast_debug(3, "Requester closed the connection while downloading '%s'\n", path);
453                                 }
454                                 break;
455                         }
456                 }

If i remove it, it works fine. I guess that the ast_http_send function is enough in this case.

By: Andrew Latham (lathama) 2010-04-29 11:20:38

In Trunk.. we are seeing issues with the Asterisk HTTP server not returning a content-type with the GUI and some other issues with recent changes.  As the current commercial project wraps up we will have time to document this...

By: Digium Subversion (svnbot) 2010-06-15 16:10:15

Repository: asterisk
Revision: 270660

U   trunk/res/res_phoneprov.c

r270660 | twilson | 2010-06-15 16:10:15 -0500 (Tue, 15 Jun 2010) | 15 lines

Don't send files twice and remove extra \r\n from header

After the manager http auth changes, we forgot to remove the manual
sending of the file. Also, ast_http_send adds two \r\n to the header that
is passed to it, so a trailing \r\n is removed from the Content-type
header. It might be better to change ast_http_send, but I don't like changing
the behavior of an API function.

(closes issue ASTERISK-16009)
Reported by: cjacobsen
     patch2.diff uploaded by cjacobsen (license 1029)
Tested by: lathama, cjacobsen