ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

HTTP Request Head Problem

August 07, 2012 8:44pm

Subscribe [2]
  • #1 / Aug 07, 2012 8:44pm

    Blair L

    110 posts

    I’m trying to generate a SMIL file for a streaming server to read and they responded with this:

    The problem here is the dynamic nature of your SMIL files.

    It appears the HTTP request HEAD does not return any information about the file in question. As a basic HTTP transaction

    Connected to example.com
    Escape character is ‘^]’.
    HEAD http://example.com/feeds/smil/573.smil HTTP/1.0

    HTTP/1.0 200 OK
    Date: Tue, 07 Aug 2012 13:52:14 GMT
    Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r
    Set-Cookie: exp_last_visit=1028987534; expires=Wed, 07-Aug-2013 13:52:14 GMT; path=/
    Set-Cookie: exp_last_activity=1344347534; expires=Wed, 07-Aug-2013 13:52:14 GMT; path=/
    Expires: Mon, 26 Jul 1997 05:00:00 GMT
    Last-Modified: Tue, 07 Aug 2012 13:52:14 GMT
    Pragma: no-cache
    MS-Author-Via: DAV
    Cache-Control: public
    Vary: Accept-Encoding
    Connection: close
    Content-Type: text/xml

    For your SMIL in the examples below , which is http://example.com/feeds/smil/573.smil , no Content-Length is returned.

    MediaCache uses the HTTP HEAD command to determine if the asset being requested is available and its length before attempting to get the content.

    You will need to change your code to support the HEAD command so it returns the correct Content-Length for the content in question.

    As a working example you can see below

    Connected to 10.1.1.201.
    Escape character is ‘^]’.
    HEAD /demo/demo1/test.smil HTTP/1.0

    HTTP/1.1 200 OK
    Date: Tue, 07 Aug 2012 13:53:29 GMT
    Server: Apache/2.2.21 (Unix) PHP/5.3.8
    Last-Modified: Tue, 07 Aug 2012 13:50:37 GMT
    ETag: “4e160-2ae-4c6ad476fe540”
    Accept-Ranges: bytes
    Content-Length: 686
    Connection: close
    Content-Type: application/smil+xml

    The Content-Length is returned and this SMIL file goes into the cache successfully.

    Can EE do this?

  • #2 / Aug 08, 2012 2:16pm

    Kevin Smith

    4784 posts

    Hi Blair,

    I’m not familiar with SMIL myself, but I’ll do my best to help here. What template type are you using to create these SMIL files? Could you paste the contents of that template here so we can get some context on this?

  • #3 / Aug 08, 2012 2:22pm

    Blair L

    110 posts

    SMIL is an xml playlist for usually dynamic HLS/iOS feeds and also is being used for flash.  Short and simple.  I’m using this with Wowza Media Server (java, streaming app).

    EE Template code:

    {exp:channel:entries channel="live" show_expired="yes" status="open|pending" disable="member_data|category_fields|pagination" show_future="no" dynamic="on" limit="1" cache="yes" refresh="360"}
    <smil>
        <head>
        </head>
        <body>
            <switch>
                <video src="mp4:/vod/1280/{if filename_override}{filename_override}{if:else}{entry_date format="%Y_%m-%d"}{/if}.mp4" system-bitrate="3500000"/>         
                <video src="mp4:/vod/960/{if filename_override}{filename_override}{if:else}{entry_date format="%Y_%m-%d"}{/if}.mp4" system-bitrate="1500000"/>
                <video src="mp4:/vod/720/{if filename_override}{filename_override}{if:else}{entry_date format="%Y_%m-%d"}{/if}.mp4" system-bitrate="800000"/>
                <video src="mp4:/vod/640/{if filename_override}{filename_override}{if:else}{entry_date format="%Y_%m-%d"}{/if}.mp4" system-bitrate="400000"/>
                <video src="mp4:/vod/640/{if filename_override}{filename_override}{if:else}{entry_date format="%Y_%m-%d"}{/if}.mp4" system-bitrate="64000"><param name="audioOnly" value="TRUE" valuetype="data"></video>
            </switch>
        </body>
    </smil>
    {/exp:channel:entries}

    Type is XML.

  • #4 / Aug 09, 2012 10:34am

    Shane Eckert

    7174 posts

    Hey Blair L,

    Do you have the template type for this set to XML?

    XML: Used for outputting XML pages with EE. It tells ExpressionEngine to send “text/xml” MIME type server headers when being viewed.

    Thank you,

  • #5 / Aug 09, 2012 10:41am

    Blair L

    110 posts

    Yes…

    Type is XML.

  • #6 / Aug 09, 2012 1:13pm

    Shane Eckert

    7174 posts

    Hello Blair,

    And that is working now?

    Thank you,

  • #7 / Aug 09, 2012 1:51pm

    Blair L

    110 posts

    Well no. It had been set to XML (give me some credit here) and wasn’t generating the content length field they were asking for.  Is that something on the EE side?

  • #8 / Aug 09, 2012 2:20pm

    Robin Sowell

    13255 posts

    Huh.  Can you link to the xml?  I just want to take a look at it w/live headers on.  When I check my local install, content length is there:

    HTTP/1.1 200 OK
    Date: Thu, 09 Aug 2012 18:13:19 GMT
    Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
    X-Powered-By: PHP/5.3.6
    Set-Cookie: exp_sessionid=9ef6bf1b4355b114e7a331b5d5211c6ae4aa6dcf; expires=Thu, 09-Aug-2012 20:13:19 GMT; path=/
    Set-Cookie: exp_expiration=1376071999; expires=Fri, 09-Aug-2013 18:13:19 GMT; path=/
    Set-Cookie: exp_flash=deleted; expires=Wed, 10-Aug-2011 18:13:18 GMT; path=/
    Set-Cookie: exp_tracker=a:5:{i:0;s:11:"about/xml_t";i:1;s:10:"news/xml_t";i:2;s:8:"news/rss";i:3;s:12:"news/rss_xml";i:4;s:8:"news/rss";}; path=/
    Expires: Mon, 26 Jul 1997 05:00:00 GMT
    Last-Modified: Thu, 09 Aug 2012 18:13:19 GMT
    Pragma: no-cache
    Content-Length: 24
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Content-Type: text/xml

    Assuming you’ve got headers on- but if you didn’t, you wouldn’t have see what you did.

    If I just stick a test.html file on my server with ‘hello world’ that also gives me the content length.  So part way wondering if this is server related.  If you toss up any kind of html file outside of ee, are you getting the content length showing?  And can you link me to that as well.

    EE does specify length in some cases- for example, css:

    @header('Content-Length: '.strlen($stylesheet));

    And I’m sure we can get EE to do it for you (pretty much per the above type approach).  I’m just wondering if it’s really more a server setting issue.  Anyway- let’s see a link the the template xml and a test html page outside of EE and see if that gives us any hints.

  • #9 / Aug 10, 2012 12:19am

    Blair L

    110 posts

    Using the HTTP command HEAD I can see that the Content-Length header is not returned, as a basic test you can use telnet to simulate a request, so on your server

    telnet example.com 80
    Trying 123.123.123.123…
    Connected to example.com
    Escape character is ‘^]’.
    HEAD http://example.com/feeds/smil/573.smil HTTP/1.0

    HTTP/1.0 200 OK
    Date: Thu, 09 Aug 2012 23:16:58 GMT
    Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r
    Set-Cookie: exp_last_visit=1029194218; expires=Fri, 09-Aug-2013 23:16:58 GMT; path=/
    Set-Cookie: exp_last_activity=1344554218; expires=Fri, 09-Aug-2013 23:16:58 GMT; path=/
    Expires: Mon, 26 Jul 1997 05:00:00 GMT
    Last-Modified: Thu, 09 Aug 2012 23:16:58 GMT
    Pragma: no-cache
    MS-Author-Via: DAV
    Cache-Control: public
    Vary: Accept-Encoding
    Connection: close
    Content-Type: text/xml

    Notice there is no Content-Length header.

    Now if I issue a HEAD command to a file which I think is on your server

    telnet example.com 80
    Trying 123.123.123.123…
    Connected to example.com.
    Escape character is ‘^]’.
    HEAD http://example.com/vod/960/2012_04-26.mp4 HTTP/1.0

    HTTP/1.1 200 OK
    Date: Thu, 09 Aug 2012 23:22:29 GMT
    Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r
    Last-Modified: Fri, 27 Apr 2012 20:28:29 GMT
    Accept-Ranges: bytes
    Content-Length: 1167691640
    Cache-Control: public
    Expires: Sun, 04 Aug 2013 23:22:29 GMT
    MS-Author-Via: DAV
    Connection: close
    Content-Type: video/mp4

    Notice I get a Content-Length header in the response.

    This is where the issue is. The web service is not responding correctly to a HEAD command for your SMIL files, consequently MediaCache can not get them as there is no Content-Length header returned when the HTTP HEAD command is used.

    So my question then is if this is caused by php or a server config?  I’m completely in the dark about what this is.

  • #10 / Aug 10, 2012 12:21am

    Blair L

    110 posts

    The URL of the smil we’re trying to test is recording.music.unt.edu/feeds/smil/

  • #11 / Aug 10, 2012 9:27am

    Robin Sowell

    13255 posts

    Hrm- I’m still digging.  If I check live headers when I visit recording.music.unt.edu/feeds/smil/, I get a content length.

    HTTP/1.1 200 OK
    Date: Fri, 10 Aug 2012 13:21:31 GMT
    Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r
    Set-Cookie: exp_last_visit=1029244891; expires=Sat, 10-Aug-2013 13:21:31 GMT; path=/
    Set-Cookie: exp_last_activity=1344604891; expires=Sat, 10-Aug-2013 13:21:31 GMT; path=/
    Set-Cookie: exp_tracker=a:1:{i:0;s:10:"feeds/smil";}; path=/
    Expires: Mon, 26 Jul 1997 05:00:00 GMT
    Last-Modified: Fri, 10 Aug 2012 13:21:31 GMT
    Pragma: no-cache
    Content-Encoding: gzip
    Vary: Accept-Encoding
    MS-Author-Via: DAV
    Cache-Control: public
    Content-Length: 239
    Keep-Alive: timeout=30, max=300
    Connection: Keep-Alive
    Content-Type: text/xml

    I may have to pull in some other folks- I’m not to sure on this one either.  Hang tight, Blair.  We’ll get it figured out.

  • #12 / Aug 10, 2012 11:08am

    Robin Sowell

    13255 posts

    Well- I learned something new today!

    I did replicate, meaning I was getting the content_length in a get request looking at http live headers, but not via telnet.  Which- IDEK.  So, I googled, and think this explanation is likely dead on target.  Which suggests it’s server related, though I didn’t dig how the heck you’d configure the server in this regard.  Wes also found this one where chunk encoding resulted in no content length.  I don’t think that’s what’s going on here, in part because the amount of content is so small.

    But yes- see if the server admin has some ideas based on the above.  I think that’s the right way to approach this one.  And let me know what they suggest.

  • #13 / Aug 18, 2012 9:05pm

    Blair L

    110 posts

    (sorry for the delayed reply, on vacation).

    Thanks for your help Robin & friends!  I’m calling this one done, but unsolved on their end.  The solution would help reduce the step of manually making that file each time we stream live, but not enough to mess around with our webservers like that.

  • #14 / Aug 20, 2012 9:46am

    Robin Sowell

    13255 posts

    😉  Took a long weekend myself!  Hrm- wish I knew a bit more about how to setup servers, but I don’t.  I’ll call it done here as well- though if you ever do poke the server end of things, let us know.  I’ll admit to some curiosity.  And if there’s anything we can do to help on the EE end, just give a yell.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases