OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple Inc. All rights reserved. |
4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. | 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 ASSERT(m_state == CONNECTING); | 114 ASSERT(m_state == CONNECTING); |
115 ASSERT(!m_loader); | 115 ASSERT(!m_loader); |
116 ASSERT(executionContext()); | 116 ASSERT(executionContext()); |
117 | 117 |
118 ExecutionContext& executionContext = *this->executionContext(); | 118 ExecutionContext& executionContext = *this->executionContext(); |
119 ResourceRequest request(m_url); | 119 ResourceRequest request(m_url); |
120 request.setHTTPMethod(HTTPNames::GET); | 120 request.setHTTPMethod(HTTPNames::GET); |
121 request.setHTTPHeaderField(HTTPNames::Accept, "text/event-stream"); | 121 request.setHTTPHeaderField(HTTPNames::Accept, "text/event-stream"); |
122 request.setHTTPHeaderField(HTTPNames::Cache_Control, "no-cache"); | 122 request.setHTTPHeaderField(HTTPNames::Cache_Control, "no-cache"); |
123 request.setRequestContext(WebURLRequest::RequestContextEventSource); | 123 request.setRequestContext(WebURLRequest::RequestContextEventSource); |
| 124 request.setIsExternalRequest(executionContext.securityContext().isHostedInRe
servedIPRange()); |
124 if (m_parser && !m_parser->lastEventId().isEmpty()) { | 125 if (m_parser && !m_parser->lastEventId().isEmpty()) { |
125 // HTTP headers are Latin-1 byte strings, but the Last-Event-ID header i
s encoded as UTF-8. | 126 // HTTP headers are Latin-1 byte strings, but the Last-Event-ID header i
s encoded as UTF-8. |
126 // TODO(davidben): This should be captured in the type of setHTTPHeaderF
ield's arguments. | 127 // TODO(davidben): This should be captured in the type of setHTTPHeaderF
ield's arguments. |
127 CString lastEventIdUtf8 = m_parser->lastEventId().utf8(); | 128 CString lastEventIdUtf8 = m_parser->lastEventId().utf8(); |
128 request.setHTTPHeaderField(HTTPNames::Last_Event_ID, AtomicString(reinte
rpret_cast<const LChar*>(lastEventIdUtf8.data()), lastEventIdUtf8.length())); | 129 request.setHTTPHeaderField(HTTPNames::Last_Event_ID, AtomicString(reinte
rpret_cast<const LChar*>(lastEventIdUtf8.data()), lastEventIdUtf8.length())); |
129 } | 130 } |
130 | 131 |
131 SecurityOrigin* origin = executionContext.securityOrigin(); | 132 SecurityOrigin* origin = executionContext.securityOrigin(); |
132 | 133 |
133 ThreadableLoaderOptions options; | 134 ThreadableLoaderOptions options; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 348 |
348 DEFINE_TRACE(EventSource) | 349 DEFINE_TRACE(EventSource) |
349 { | 350 { |
350 visitor->trace(m_parser); | 351 visitor->trace(m_parser); |
351 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); | 352 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); |
352 ContextLifecycleObserver::trace(visitor); | 353 ContextLifecycleObserver::trace(visitor); |
353 EventSourceParser::Client::trace(visitor); | 354 EventSourceParser::Client::trace(visitor); |
354 } | 355 } |
355 | 356 |
356 } // namespace blink | 357 } // namespace blink |
OLD | NEW |