ChatSecure-iOS icon indicating copy to clipboard operation
ChatSecure-iOS copied to clipboard

HTTP Upload disabled when max-file-size is unset

Open GigabyteProductions opened this issue 3 years ago • 0 comments

The buttons to upload media disappear (like #868) when setting ejabberd's mod_http_upload's max_size to infinity.

The effect of setting max_size to infinity is that the max-file-size field is absent from the upload service discovery response.

XEP-0363 does not mandate the presence of max-file-size, and says "an entity SHOULD also include the maximum file size ... if such a limitation exists." I prefer not to impose the limitation on my private server.

Example query:

<iq from="[email protected]" id="query1" to="upload.gigabyteproductions.net" type="get">
  <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>

Response with max-file-size set (works with ChatSecure 5.0.3):

<iq lang="en" to="[email protected]/98045830788806205731282" from="upload.gigabyteproductions.net" type="result" id="query1">
  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity name="HTTP File Upload" type="file" category="store"/>
    <feature var="urn:xmpp:http:upload"/>
    <feature var="urn:xmpp:http:upload:0"/>
    <feature var="eu:siacs:conversations:http:upload"/>
    <feature var="vcard-temp"/>
    <feature var="http://jabber.org/protocol/disco#info"/>
    <feature var="http://jabber.org/protocol/disco#items"/>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>urn:xmpp:http:upload</value>
      </field>
      <field var="max-file-size" type="text-single" label="Maximum file size">
        <value>1099511627776</value>
      </field>
    </x>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>urn:xmpp:http:upload:0</value>
      </field>
      <field var="max-file-size" type="text-single" label="Maximum file size">
        <value>1099511627776</value>
      </field>
    </x>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>http://jabber.org/network/serverinfo</value>
      </field>
    </x>
  </query>
</iq>

Response without max-file-size set (does not work with ChatSecure 5.0.3):

<iq lang="en" to="[email protected]/98045830788806205731282" from="upload.gigabyteproductions.net" type="result" id="query2">
  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity name="HTTP File Upload" type="file" category="store"/>
    <feature var="urn:xmpp:http:upload"/>
    <feature var="urn:xmpp:http:upload:0"/>
    <feature var="eu:siacs:conversations:http:upload"/>
    <feature var="vcard-temp"/>
    <feature var="http://jabber.org/protocol/disco#info"/>
    <feature var="http://jabber.org/protocol/disco#items"/>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>http://jabber.org/network/serverinfo</value>
      </field>
    </x>
  </query>
</iq>

GigabyteProductions avatar May 29 '21 10:05 GigabyteProductions