ChatSecure / ChatSecure-iOS

ChatSecure is a free and open source encrypted chat client for iOS that supports OTR and OMEMO encryption over XMPP.
https://chatsecure.org
Other
3.13k stars 1.03k forks source link

HTTP Upload disabled when max-file-size is unset #1241

Open GigabyteProductions opened 3 years ago

GigabyteProductions commented 3 years ago

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="gigabyteproductions@gigabyteproductions.net" 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="gigabyteproductions@gigabyteproductions.net/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="gigabyteproductions@gigabyteproductions.net/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>