Changeset 8cb503d for apps/ministreaming


Ignore:
Timestamp:
Dec 15, 2013 3:16:54 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
01b1534, 2b39d28
Parents:
efff25a
Message:

EepGet?: Allow override of the User-Agent
i2psnark: Set User-Agent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java

    refff25a r8cb503d  
    77import java.net.UnknownHostException;
    88import java.net.URL;
     9import java.util.Locale;
    910import java.util.Properties;
    1011
     
    194195                   "Cache-control: no-cache\r\n" +
    195196                   "Pragma: no-cache\r\n" +
    196                    "User-Agent: " + USER_AGENT + "\r\n" +
    197197                   "Connection: close\r\n");
     198        boolean uaOverridden = false;
    198199        if (_extraHeaders != null) {
    199200            for (String hdr : _extraHeaders) {
     201                if (hdr.toLowerCase(Locale.US).startsWith("user-agent: "))
     202                    uaOverridden = true;
    200203                buf.append(hdr).append("\r\n");
    201204            }
    202205        }
     206        if(!uaOverridden)
     207            buf.append("User-Agent: " + USER_AGENT + "\r\n");
    203208        buf.append("\r\n");
    204209        return buf.toString();
Note: See TracChangeset for help on using the changeset viewer.